public ActionResult CreateNaprav(Naprav naprav) { bool Status = false; string message = ""; if (ModelState.IsValid) { using (ClinicModel dc = new ClinicModel()) { var e = dc.Pacients.Where(a => a.ID_Pacinents == naprav.ID_Pacients).FirstOrDefault(); var p = dc.Procedure.Where(a => a.ID_Procedure == naprav.ID_Procedure).FirstOrDefault(); if (e == null) { ModelState.AddModelError("donapExist", "Введені не існуючі дані"); return(View(naprav)); } else if (p == null) { ModelState.AddModelError("donappExist", "Введені не існуючі дані"); return(View(naprav)); } } } else { message = "Невірний запит"; } ViewBag.Message = message; ViewBag.Status = Status; db.Entry(naprav).State = EntityState.Added; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult CreateEquip(Equipments equipments) { bool Status = false; string message = ""; if (!ModelState.IsValid) { message = "Невірний запит"; } ViewBag.Message = message; ViewBag.Status = Status; db.Entry(equipments).State = EntityState.Added; db.SaveChanges(); return(RedirectToAction("Index")); }
public void Modify(AppointmentTable entity) { _context.Appointments.Attach(entity); _context.Entry(entity).State = EntityState.Modified; }
public void Modify(PatientTable entity) { _context.Patients.Attach(entity); _context.Entry(entity).State = EntityState.Modified; }
public void Modify(ClinicTable entity) { _context.Clinicians.Attach(entity); _context.Entry(entity).State = EntityState.Modified; }
public void Modify(UserTable entity) { _context.Users.Attach(entity); _context.Entry(entity).State = EntityState.Modified; }