public ActionResult Bookings() { List <Booking> books = new List <Booking>(); UserBookingService bservice = new UserBookingService(); int id = Convert.ToInt32(Session["USERID"]); books = bservice.getAllBookings(id); //return books[0].PlaceId.ToString(); List <Subscriptions> sub = new List <Subscriptions>(); sub = bservice.GetAllSubscriptions(id); List <UserBookingModel> data = new List <UserBookingModel>(); PlaceService pserv = new PlaceService(); for (int i = 0; i < books.Count; i++) { ParkingPlace pl = new ParkingPlace(); pl = pserv.getPlaceInfo(books[i].PlaceId); //return pl.SpotName.ToString(); UserBookingModel mod = new UserBookingModel(); mod.Name = pl.SpotName; mod.PlaceId = pl.ID; mod.IsPending = books[i].IsPending; mod.Price = pl.PricePerHour; mod.idBook = 1; //means book type data.Add(mod); } for (int i = 0; i < sub.Count; i++) { ParkingPlace pl = new ParkingPlace(); pl = pserv.getPlaceInfo(sub[i].PlaceId); UserBookingModel mod = new UserBookingModel(); mod.Name = pl.SpotName; mod.PlaceId = pl.ID; mod.Price = pl.PricePerHour; mod.idBook = 0; //means subs type mod.Date = sub[i].End; data.Add(mod); } //return "none"; return(View("bookings", data)); }
public ActionResult GetAllSubscription() { List <Subscriptions> places = new List <Subscriptions>(); if (Session["type"].ToString() == "1") { UserBookingService BService = new UserBookingService(); int id = Convert.ToInt32(Session["USERID"]); places = BService.GetAllSubscriptions(id); return(View("home", places)); } else { return(RedirectToAction("index", "Login")); } }