public ActionResult Edit(int id) { TempData["UpdateId"] = id; tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id); return(View(ad)); }
public ActionResult Delete(int id) { tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id); dc.tblDoctorAbsences.Remove(ad); dc.SaveChanges(); return(RedirectToAction("list")); }
public ActionResult Details(int id) { tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id); ViewBag.DoctorName = (from ob in dc.tblDoctors where ob.DoctorId == ad.DoctorId select ob).Take(1).SingleOrDefault().FirstName; string name = ViewBag.DoctorName; return(View(ad)); }
public ActionResult Edit(FormCollection form) { int id = Convert.ToInt32(TempData["UpdateId"]); tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id); ad.DoctorId = Convert.ToInt32(form["DoctorId"]); ad.FromTime = TimeSpan.Parse(form["FromTime"]); ad.ToDate = Convert.ToDateTime(form["ToDate"]); ad.FromDate = Convert.ToDateTime(form["FromDate"]); dc.SaveChanges(); return(RedirectToAction("Index", "DoctorAbsent")); }
public ActionResult Insert(FormCollection form) { tblDoctorAbsence ad = new tblDoctorAbsence(); ad.DoctorId = Convert.ToInt32(form["DoctorId"]); ad.FromDate = Convert.ToDateTime(form["FromDate"]); ad.ToDate = Convert.ToDateTime(form["ToDate"]); ad.FromTime = TimeSpan.Parse(form["FromTime"]); ad.CreatedOn = DateTime.Now; dc.tblDoctorAbsences.Add(ad); dc.SaveChanges(); return(RedirectToAction("Index", "DoctorAbsent")); }