public IActionResult GetListSeat([FromBody] string Timevalue) { if (!string.IsNullOrEmpty(Timevalue)) { int RouteId = Convert.ToInt32(Timevalue); var Route = _IRou.GetRouteById(RouteId); var listSeat = _ISeat.GetAllByBusId(Route.BusId); return(Json(listSeat)); } return(Json("0")); }
public IActionResult Index([FromQuery] int seat, [FromQuery] string cateprice, [FromQuery] string routeprice, [FromQuery] int RouteId) { if (CookieSupport.CheckCookieExists(HttpContext, CookieSupport.InfoBooking) == false) { return(RedirectToAction("index", "home")); } BookingView inforBooking = JsonConvert.DeserializeObject <BookingView>(HttpContext.Request.Cookies[CookieSupport.InfoBooking]); inforBooking.SeatId = seat; inforBooking.CategoryPrice = Convert.ToDecimal(cateprice); inforBooking.RoutePrice = Convert.ToDecimal(routeprice); inforBooking.RouteId = RouteId; var route = _IRou.GetRouteById(inforBooking.RouteId); inforBooking.BusId = route.BusId; if (CookieSupport.CheckCookieExists(HttpContext, CookieSupport.InfoBooking)) { CookieSupport.Remove(HttpContext, CookieSupport.InfoBooking); CookieSupport.Set(HttpContext, CookieSupport.InfoBooking, JsonConvert.SerializeObject(inforBooking), DateTime.Now.Minute + 5); BookingView inforBooking2 = JsonConvert.DeserializeObject <BookingView>(HttpContext.Request.Cookies[CookieSupport.InfoBooking]); } else { CookieSupport.Set(HttpContext, CookieSupport.InfoBooking, JsonConvert.SerializeObject(inforBooking), DateTime.Now.Minute + 5); } return(View()); }