示例#1
0
 public ActionResult Reservation_Add(RESERVATION reservation)
 {
     if (ModelState.IsValid)
     {
         try
         {
             reservation.RESERVATIONSTATE_ID = 1;
             ReservationDA.Add(reservation);
             return(Json(new { SuccessMsg = "Rezervation Added." }));
         }
         catch (Exception ex)
         {
             return(Json(new { ErrorMsg = "Try Again." }));
         }
     }
     else
     {
         return(Json(new { ErrorMsg = "Check All Fields." }));
     }
 }
示例#2
0
 public ActionResult AddReservationForm(RESERVATION reservation)
 {
     try
     {
         if (ModelState.IsValid)
         {
             reservationDA.Add(reservation);
             return(RedirectToAction("Reservations", "Admin"));
         }
         else
         {
             ViewBag.Error = "Try Again.";
             PopulateReservationStateDropdownList(reservation.RESERVATIONSTATE_ID);
             return(View("Reservation_Add", reservation));
         }
     }
     catch (Exception ex)
     {
         ViewBag.Error = "Try Again.";
         PopulateReservationStateDropdownList(reservation.RESERVATIONSTATE_ID);
         return(View("Reservation_Add", reservation));
     }
 }