public ActionResult Reservation(string message, int type = 0) { List <SelectListItem> billingTypes = new List <SelectListItem>(); billingTypes.Add(new SelectListItem() { Text = "Cash", Value = "1" }); billingTypes.Add(new SelectListItem() { Text = "Card", Value = "2" }); ViewBag.billingTypes = new SelectList(billingTypes, "Value", "Text"); IList <Roomtype> roomTypes = _hotelReservationService.LoadAllHotelTypes(); ViewBag.roomTypes = new SelectList(roomTypes, "Id", "Name"); ViewBag.roomTypeList = roomTypes; IList <Room> rooms = _hotelReservationService.LoadAllRooms(); ViewBag.roomList = rooms; if (!String.IsNullOrEmpty(message) && type == 1)//success { ViewBag.SuccessMessage = message; } if (!String.IsNullOrEmpty(message) && type == 2)//failed { ViewBag.ErrorMessage = message; } return(View()); }
public ActionResult ManageRoom(int draw, int start, int length, long roomTypeId = 0) { IList <Room> roomList = _hotelReservationService.LoadAllRooms(draw, start, length, roomTypeId); int count = _hotelReservationService.CountAllRooms(roomTypeId); var data = new List <object>(); int sl = start + 1; foreach (var room in roomList) { var str = new List <string>(); str.Add(sl.ToString()); str.Add(room.Roomtype.Name); str.Add(room.Roomno); str.Add(Convert.ToInt32(room.Noofadult).ToString()); str.Add(Convert.ToInt32(room.Maxchild).ToString()); str.Add(LinkGenerator.GetGeneratedDetailsEditLink("RoomDetails", "EditRoom", "HotelRoom", room.Id) + LinkGenerator.GetDeleteLink("RoomDelete", "HotelRoom", room.Id)); data.Add(str); sl++; } return(Json(new { draw = draw, recordsTotal = count, recordsFiltered = count, start = start, length = length, data = data })); return(View()); }