コード例 #1
0
        public ActionResult addReservationinfo(ReservationInfoViewModel formValues)
        {
            if (TempData.ContainsKey("adminId"))
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        ReservationInfoViewModel ReservationInfoTuple = new ReservationInfoViewModel();
                        ViewBag.timeSlot = ReservationInfoTuple.timeSlots;
                        reservationInfo reservationInfoTuple = formValues.getReservationInfoValues();
                        dbContext.reservationInfoes.Add(reservationInfoTuple);
                        dbContext.SaveChanges();

                        return(RedirectToAction("index"));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.exception = ex.Message;
                        return(View());
                    }
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                TempData.Clear();
                return(RedirectToAction("LogIn", "LogIn"));
            }
        }