예제 #1
0
        public ActionResult ManageReservation(int draw, int start, int length)
        {
            try
            {
                IList <Roomregister> roomregisters = _hotelReservationService.LoadAllReservation();
                int count = roomregisters.Count;

                var data = new List <object>();
                int sl   = start + 1;
                foreach (var roomRegister in roomregisters)
                {
                    var str = new List <string>();
                    str.Add(sl.ToString());
                    str.Add(roomRegister.Customer.Firstname);
                    str.Add(roomRegister.Customer.Contactnumber);
                    List <string> roomNo   = roomRegister.Roomhistories.Select(x => x.Room.Roomno).ToList();
                    string        allRooms = string.Join(",", roomNo);
                    str.Add(allRooms);
                    str.Add(Convert.ToDateTime(roomRegister.Checkindate).ToString("g"));
                    str.Add(Convert.ToDateTime(roomRegister.Checkoutdate).ToString("g"));

                    str.Add(LinkGenerator.GetGeneratedDetailsEditLink("ReservationDetails", "EditReservaion", "HotelReservation", roomRegister.Id)
                            + LinkGenerator.GetInvoiceLink("InvoiceGenerate", "HotelReservation", roomRegister.Id));
                    data.Add(str);
                    sl++;
                }
                return(Json(new
                {
                    draw = draw,
                    recordsTotal = count,
                    recordsFiltered = count,
                    start = start,
                    length = length,
                    data = data
                }));
            }
            catch (Exception)
            {
                throw;
            }
        }