public ActionResult CancelRequest(int id) { OwnerBookingManagementService service = new OwnerBookingManagementService(); service.cancelRequest(id); return(RedirectToAction("requests", "Owner")); }
public ActionResult requests() { if (Session["type"].ToString() == "2") { List <Booking> books = new List <Booking>(); List <Subscriptions> subs = new List <Subscriptions>(); OwnerBookingManagementService owservice = new OwnerBookingManagementService(); int id = Convert.ToInt32(Session["USERID"]); books = owservice.getAllBookings(id); subs = owservice.getAllSubscriptions(id); List <OwnerBookingModel> data = new List <OwnerBookingModel>(); /* * public int isBook { get; set; } * * public int BookId { get; set; } * public string ParkerName { get; set; } * public string PlaceName { get; set; } * public DateTime Date { get; set; } * public DateTime From { get; set; } * public DateTime To { get; set; } * * public int IsPending { get; set; } */ PlaceService pserv = new PlaceService(); for (int i = 0; i < books.Count; i++) { int uId = books[i].UserId, pId = books[i].PlaceId; AuthService srv = new AuthService(); string parkerName = srv.getUsername(uId); PlaceService psrv = new PlaceService(); ParkingPlace place = psrv.getPlaceInfo(pId); OwnerBookingModel mod = new OwnerBookingModel(); mod.isBook = 1; //means book type mod.BookId = books[i].ID; mod.ParkerName = parkerName; mod.PlaceName = place.SpotName; mod.IsPending = books[i].IsPending; data.Add(mod); } for (int i = 0; i < subs.Count; i++) { int uId = subs[i].UserId, pId = subs[i].PlaceId; AuthService srv = new AuthService(); string parkerName = srv.getUsername(uId); PlaceService psrv = new PlaceService(); ParkingPlace place = psrv.getPlaceInfo(pId); OwnerBookingModel mod = new OwnerBookingModel(); mod.isBook = 0; //means book type mod.BookId = subs[i].ID; mod.ParkerName = parkerName; mod.PlaceName = place.SpotName; mod.Date = subs[i].Date; mod.From = subs[i].Start; mod.To = subs[i].End; mod.IsPending = subs[i].IsPending; data.Add(mod); } return(View("requests", data)); } else { return(RedirectToAction("index", "Login")); } }