public ActionResult EditReservation(ReservationLaunderyRoom reservation)
        {
            if (IsAdmin() != true)
            {
                return RedirectToAction("Index", "Dashboard");
            }

            try
            {
                if (ModelState.IsValid)
                {
                    _reservService.SaveReservation(reservation);
                    return RedirectToAction("LaunderyReservationList");
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 public void CreateReservation(ReservationLaunderyRoom reservation)
 {
     db.ReservationLaunderyRoom.Add(reservation);
     db.SaveChanges();
 }
 public void SaveReservation(ReservationLaunderyRoom reservation)
 {
     db.Entry(reservation).State = EntityState.Modified;
     db.SaveChanges();
 }
        public ActionResult Reservation(string data)
        {
            string[] datasplit = data.Split(':');
            int day;
            DateTime clock;
            DateTime today = DateTime.Today;
            switch (datasplit[1])
            {
                case "0":
                    day = ((int)DayOfWeek.Monday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "1":
                    day = ((int)DayOfWeek.Tuesday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "2":
                    day = ((int)DayOfWeek.Wednesday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "3":
                    day = ((int)DayOfWeek.Thursday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "4":
                    day = ((int)DayOfWeek.Friday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "5":
                    day = ((int)DayOfWeek.Saturday - (int)today.DayOfWeek + 7) % 7;
                    break;
                case "6":
                    day = ((int)DayOfWeek.Friday - (int)today.DayOfWeek + 7) % 7;
                    break;
                default:
                    {
                        return View("false");
                    }
            }
            DateTime nextbooking = today.AddDays(day);
            switch (datasplit[0])
            {
                case "0":
                    clock = nextbooking.Date.AddHours(7);
                    break;
                case "1":
                    clock = nextbooking.Date.AddHours(10);
                    break;
                case "2":
                    clock = nextbooking.Date.AddHours(13);
                    break;
                case "3":
                    clock = nextbooking.Date.AddHours(16);
                    break;
                case "4":
                    clock = nextbooking.Date.AddHours(19);
                    break;
                default:
                    {
                        return View("false");
                    }
            }

            //0 and 1 is time, get time from enum.

            if (datasplit[2]+datasplit[3]==(User as CustomPrincipal).FirstName+(User as CustomPrincipal).LastName)
            {
                ReservationLaunderyRoom reservation = new ReservationLaunderyRoom();
                reservation.BookingTime = clock.AddHours(3);
                reservation.Date = clock;
                reservation.Group = "A";
                reservation.userProfileId = (User as CustomPrincipal).Id;
                _resvService.CreateReservation(reservation);
                return View("true");
            }

            return View("false");
        }