コード例 #1
0
        public ActionResult Edit(int id)
        {
            TempData["UpdateId"] = id;
            tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id);

            return(View(ad));
        }
コード例 #2
0
        public ActionResult Delete(int id)
        {
            tblDoctorAbsence ad = dc.tblDoctorAbsences.SingleOrDefault(ob => ob.DoctorAbsenceId == id);

            dc.tblDoctorAbsences.Remove(ad);
            dc.SaveChanges();
            return(RedirectToAction("list"));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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"));
        }
コード例 #5
0
        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"));
        }