public async Task <ActionResult> DeleteConfirmed(int id) { MedicalStaffEmployment medicalStaffEmployment = await db.MedicalStaffEmployments.FindAsync(id); db.MedicalStaffEmployments.Remove(medicalStaffEmployment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,MedicalStaffId,EmploymentType,MedicalInstitutionId,Salary,Vacation,EmploymentDate,DischargeDate")] MedicalStaffEmployment medicalStaffEmployment) { if (ModelState.IsValid) { db.Entry(medicalStaffEmployment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.MedicalInstitutionId = new SelectList(db.MedicalInstitutions, "Id", "MedicalInstitutionName", medicalStaffEmployment.MedicalInstitutionId); ViewBag.MedicalStaffId = new SelectList(db.MedicalStaffs.Include(ms => ms.Profile).ToList().Select(ms => new { ms.Id, Name = ms.MedicalStaffName }), "Id", "Name", medicalStaffEmployment.MedicalStaffId); return(View(medicalStaffEmployment)); }
// GET: MedicalStaffEmployments/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MedicalStaffEmployment medicalStaffEmployment = await db.MedicalStaffEmployments.FindAsync(id); if (medicalStaffEmployment == null) { return(HttpNotFound()); } return(View(medicalStaffEmployment)); }
// GET: MedicalStaffEmployments/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MedicalStaffEmployment medicalStaffEmployment = await db.MedicalStaffEmployments.FindAsync(id); if (medicalStaffEmployment == null) { return(HttpNotFound()); } ViewBag.MedicalInstitutionId = new SelectList(db.MedicalInstitutions, "Id", "MedicalInstitutionName", medicalStaffEmployment.MedicalInstitutionId); ViewBag.MedicalStaffId = new SelectList(db.MedicalStaffs.Include(ms => ms.Profile).ToList().Select(ms => new { ms.Id, Name = ms.MedicalStaffName }), "Id", "Name", medicalStaffEmployment.MedicalStaffId); return(View(medicalStaffEmployment)); }