public ActionResult Add(DoctorScheduleView model) { try { var check = _scheduleBusiness.GetEdit(model.ID, model.Day); if (check != null && check.ID != 0) { ModelState.AddModelError("ExistsDataError", "Lịch làm việc này đã được thêm. Vui lòng chỉnh sửa chi tiết, không thêm mới"); ViewBag.ShiftLst = _shiftTimeBusiness.GetAll(); ViewBag.DayLst = CreateDay.getLstDay(); return(View(model)); } if (_scheduleBusiness.Add(model)) { _scheduleBusiness.Save(); return(Redirect($"/DoctorSchedule/List/{model.ID}")); } ViewBag.ShiftLst = _shiftTimeBusiness.GetAll(); ViewBag.DayLst = CreateDay.getLstDay(); return(View(model)); } catch (Exception) { return(View()); } }
public ActionResult Edit(int id, int day) { try { ViewBag.ShiftLst = _shiftTimeBusiness.GetAll(); ViewBag.DayLst = CreateDay.getLstDay(); var result = _scheduleBusiness.GetEdit(id, day); return(View(result)); } catch (Exception) { return(View()); } }
public ActionResult Add(int id) { try { ViewBag.ShiftLst = _shiftTimeBusiness.GetAll(); ViewBag.DayLst = CreateDay.getLstDay(); DoctorScheduleView view = new DoctorScheduleView(); view.ID = id; return(View(view)); } catch (Exception) { return(View()); } }
public ActionResult Edit(DoctorScheduleView model) { try { if (_scheduleBusiness.Edit(model)) { _scheduleBusiness.Save(); return(Redirect($"/DoctorSchedule/List/{model.ID}")); } ViewBag.ShiftLst = _shiftTimeBusiness.GetAll(); ViewBag.DayLst = CreateDay.getLstDay(); return(View(model)); } catch (Exception) { return(View()); } }