public ActionResult Index(int?courtId) { CourtWorkingDaysModel workingHours = null; if (courtId != null) { SetCourtId(courtId); workingHours = _courtWorkingDaysServices.GetWorkingDaysForCourt(courtId ?? -1).FirstOrDefault(); } var dateTimeNow = DateTime.Now; var sched = new DHXScheduler(this) { Skin = DHXScheduler.Skins.Terrace, LoadData = true, InitialDate = new DateTime(dateTimeNow.Year, dateTimeNow.Month, dateTimeNow.Day), }; if (Request.IsAuthenticated) { sched.EnableDataprocessor = true; } else { sched.Config.isReadonly = true; } sched.Extensions.Add(SchedulerExtensions.Extension.Collision); sched.Extensions.Add(SchedulerExtensions.Extension.Limit); sched.Config.first_hour = workingHours != null ? workingHours.StartTime.Hour : 8; sched.Config.last_hour = workingHours != null ? workingHours.EndTime.Hour : 21; return(View(new CalendarModel() { Scheduler = sched, WorkingHours = workingHours })); }
public ActionResult Delete(int id, CourtWorkingDaysModel model) { var Id = _courtWorkingDaysServices.GetWorkingDay(id).Court.Id; _courtWorkingDaysServices.DeleteWorkingDays(id); return(RedirectToAction("Index", new { courtId = Id })); }
public ActionResult Edit(int id, CourtWorkingDaysModel model) { if (!ModelState.IsValid) { return(View(model)); } _courtWorkingDaysServices.Update(id, model); return(RedirectToAction("Index", new { courtId = model.Court.Id })); }
public ActionResult Create(CourtWorkingDaysModel model) { var id = model.Court.Id; if (!ModelState.IsValid) { return(View(model)); } _courtWorkingDaysServices.Create(id, model); return(RedirectToAction("Index", "CourtWorkingDays", new { courtId = id })); }
// Methods for working days public void Create(int courtId, CourtWorkingDaysModel model) { _courtWorkingDaysRepository.Add(model.Day, model.StartTime, model.EndTime, courtId); }
public void Update(int id, CourtWorkingDaysModel model) { _courtWorkingDaysRepository.Update(id, (DaysOfTheWeek)model.StartTime.DayOfWeek, model.StartTime, model.EndTime); }