public IActionResult Detail(int id, string errormessage)
        {
            //get the reservation data from the database
            Reservation r = _services.GetReservationById(id);
            //get the Customer Data from the database
            Customer c = _services.GetCustomerById(r.CustomerID);
            //get the Sitting Data from the database
            Sitting s = _services.GetSittingById(r.SittingID);
            //get the Tables List of this reservation from the database
            List <Table_Reservation> tds = _services.GetTRList_byReservationID(r.ReservationID);
            //get the Area Name from the database
            string MyArea = _services.GetAreaByID(id);

            ReservationDeteailsViewModel model = new ReservationDeteailsViewModel()
            {
                //Sitting
                SittingID   = s.SittingID,
                SittingName = s.SittingName,

                //Reservation
                ReservationID          = r.ReservationID,
                NumberOfGuests         = r.NumberOfGuests,
                AdditionalRequirements = r.AdditionalRequirements,
                Date      = r.Date,
                StartTime = r.StartTime,
                EndTime   = r.EndTime,
                Status    = r.Status,
                Source    = r.Source,

                //Customer
                CustomerId  = c.CustomerID,
                FirstName   = c.FirstName,
                LastName    = c.LastName,
                Email       = c.Email,
                PhoneNumber = c.PhoneNumber,

                //tables
                NumberOfTables = tds.Count,
                MyTR           = tds,
                Area           = MyArea
            };

            //setting new error message
            model.Errormessage = errormessage;
            return(View(model));
        }
 public IActionResult EditSitting(int id)
 {
     try
     {
         Sitting s = _services.GetSittingById(id);
         EditSittingViewModel Smodel = new EditSittingViewModel()
         {
             SittingID         = s.SittingID,
             SittingName       = s.SittingName,
             Sitting_EndTime   = s.Sitting_EndTime,
             Sitting_StartTime = s.Sitting_StartTime
         };
         return(View(Smodel));
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }