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
            }));
        }
Beispiel #2
0
        public ActionResult Delete(int id, CourtWorkingDaysModel model)
        {
            var Id = _courtWorkingDaysServices.GetWorkingDay(id).Court.Id;

            _courtWorkingDaysServices.DeleteWorkingDays(id);
            return(RedirectToAction("Index", new { courtId = Id }));
        }
Beispiel #3
0
 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 }));
 }
Beispiel #4
0
        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 }));
        }
Beispiel #5
0
 // Methods for working days
 public void Create(int courtId, CourtWorkingDaysModel model)
 {
     _courtWorkingDaysRepository.Add(model.Day, model.StartTime, model.EndTime, courtId);
 }
Beispiel #6
0
 public void Update(int id, CourtWorkingDaysModel model)
 {
     _courtWorkingDaysRepository.Update(id, (DaysOfTheWeek)model.StartTime.DayOfWeek, model.StartTime, model.EndTime);
 }