public async Task <ActionResult> DeleteConfirmed(int id) { ServiceStaffEmployment serviceStaffEmployment = await db.ServiceStaffEmployments.FindAsync(id); db.ServiceStaffEmployments.Remove(serviceStaffEmployment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,ServiceStaffId,MedicalInstitutionId,Salary,Vacation,EmploymentDate,DischargeDate")] ServiceStaffEmployment serviceStaffEmployment) { if (ModelState.IsValid) { db.Entry(serviceStaffEmployment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.MedicalInstitutionId = new SelectList(db.MedicalInstitutions, "Id", "MedicalInstitutionName", serviceStaffEmployment.MedicalInstitutionId); ViewBag.ServiceStaffId = new SelectList(db.ServiceStaffs.Include(ss => ss.Specialty).ToList().Select(ss => new { ss.Id, Name = ss.FirstName + " " + ss.SecondName + "|" + ss.Specialty.SpecialtyName }), "Id", "Name", serviceStaffEmployment.ServiceStaffId); return(View(serviceStaffEmployment)); }
// GET: ServiceStaffEmployments/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceStaffEmployment serviceStaffEmployment = await db.ServiceStaffEmployments.FindAsync(id); if (serviceStaffEmployment == null) { return(HttpNotFound()); } return(View(serviceStaffEmployment)); }
// GET: ServiceStaffEmployments/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ServiceStaffEmployment serviceStaffEmployment = await db.ServiceStaffEmployments.FindAsync(id); if (serviceStaffEmployment == null) { return(HttpNotFound()); } ViewBag.MedicalInstitutionId = new SelectList(db.MedicalInstitutions, "Id", "MedicalInstitutionName", serviceStaffEmployment.MedicalInstitutionId); ViewBag.ServiceStaffId = new SelectList(db.ServiceStaffs.Include(ss => ss.Specialty).ToList().Select(ss => new { ss.Id, Name = ss.FirstName + " " + ss.SecondName + "|" + ss.Specialty.SpecialtyName }), "Id", "Name", serviceStaffEmployment.ServiceStaffId); return(View(serviceStaffEmployment)); }