public IActionResult AddNewTable(ReservationDeteailsViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             //getting list of tables that are booked in the same period that the current reservation
             List <Table_Reservation> Unavailabe_Tables = _services.GetListTable(model.Date, model.StartTime);
             foreach (var table in Unavailabe_Tables)
             {
                 //check if the choosen table is not in the list of Unavailabe_Tables
                 if (table.TableID == model.TableID)
                 {
                     model.Errormessage = "Sorry this table is already booked during that period";
                     //(if it is) return detailspage with an error message
                     return(RedirectToAction("Detail", new { id = model.ReservationID, errormessage = model.Errormessage }));
                 }
             }
             model.Errormessage = "The table was added";
             //(if NOT) set new table to the resrvation
             _services.AddTable(model.ReservationID, model.TableID);
         }
         catch
         {
             model.Errormessage = "You havent choosen any table";
             //if an error happens return, no tables were selected
             return(RedirectToAction("Detail", new { id = model.ReservationID, errormessage = model.Errormessage }));
         }
     }
     //if modelstate is not valid return detail page
     return(RedirectToAction("Detail", new { id = model.ReservationID }));
 }