введите код здесь # Контроллер
public ActionResult DoctorLogin(tbl_DoctorPersonalDetail admin)
{
var key = GetKey();
admin.str_Password = EncryptString(key, admin.str_Password);
var _admin = db.tbl_DoctorPersonalDetails.Where(s => s.str_UserName == admin.str_Password);
if (_admin.Any())
{
if (_admin.Where(s => s.str_UserName == admin.str_Password).Any())
{
return RedirectToAction("WelcomePage");
}
else
{
return Json(new { status = false, message = "Invalid Password!" });
}
}
else
{
return Json(new { status = false, message = "Invalid Email!" });
}
}
# DBContext
public class EmployeeContext : DbContext
{
public EmployeeContext(DbContextOptions<EmployeeContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
public virtual DbSet<Helath> Helaths { get; set; }
public virtual DbSet<Patient> Patients { get; set; }
public virtual DbSet<tbl_DoctorEducationDetails> tbl_DoctorEducationDetails { get; set; }
public virtual DbSet<tbl_DoctorPersonalDetail> tbl_DoctorPersonalDetails { get; set; }
public virtual DbSet<tbl_EmployeeDetail> tbl_EmployeeDetail { get; set; }
public virtual DbSet<tbl_Experiance> tbl_Experiance { get; set; }
Модель
public partial class tbl_DoctorPersonalDetail
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public tbl_DoctorPersonalDetail()
{
this.tbl_DoctorEducationDetails = new HashSet<tbl_DoctorEducationDetails>();
this.tbl_Experiance = new HashSet<tbl_Experiance>();
}
[Key]
public int lng_DoctorID { get; set; }
public string str_DoctorName { get; set; }
public int lng_Age { get; set; }
public string str_dob { get; set; }
public string str_FatherName { get; set; }
public string str_MotherName { get; set; }
public string str_SpouseName { get; set; }
public string str_Address { get; set; }
public string str_ContactNo { get; set; }
public string str_Email { get; set; }
public string str_UserName { get; set; }
public string str_Password { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<tbl_DoctorEducationDetails> tbl_DoctorEducationDetails { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<tbl_Experiance> tbl_Experiance { get; set; }
}
Тип сущности 'tbl_DoctorEducationDetails' требует определения первичного ключа, показывающего эту ошибку