public async Task<ActionResult>  Save(RoomAllocation roomAllocation, RoomStatus_detailViewModel m )
        {
            if (await _RoomAllocationRepository.GetRoomNumberExists(roomAllocation.RoomNumber, roomAllocation.Id))
                            ModelState.AddModelError("RoomNumber", "Please enter unique room number");

            if (ModelState.IsValid)
            {
                if (roomAllocation.Id == 0)
                {
                     roomAllocation.RoomStatusTypeId = 1;
                   await _RoomAllocationRepository.Create(roomAllocation);
                }
                else
                {
                    if (roomAllocation.RoomStatusTypeId != 1)
                    {
                        m.RoomStatus_Detail.RoomAllocationId = roomAllocation.Id;
                        m.RoomStatus_Detail.RoomStatusTypeId = roomAllocation.RoomStatusTypeId;
                        if (m.newrec)

                          await  _RoomStatus_DetailRepository.Create(m.RoomStatus_Detail);

                        else
                            _RoomStatus_DetailRepository.Update(m.RoomStatus_Detail, m.RoomStatus_Detail.Id.ToString ());
                    }

                    _RoomAllocationRepository.Update(roomAllocation, roomAllocation.Id.ToString ());
                }

            }
            else
            {
                SearchRoomAllocation searchroomAllocation = new SearchRoomAllocation();

                await GetTypes(roomAllocation.RoomTypeId, roomAllocation.WingId, roomAllocation.RoomStatusTypeId  );
                await GetSearchTypes(1, 1, 1);
                var roomallocations = getList("", "", 1, await _RoomAllocationRepository.GetAll());
                RoomAllocationViewModel model = new RoomAllocationViewModel { List = roomallocations, RoomAllocation = roomAllocation, SearchRoomAllocation = searchroomAllocation };
                 return View("Index", model);
            }
            return RedirectToAction("Index");
        }
    //[ChildActionOnly]
        public async Task<ActionResult>  GetRoomStatus_detailViewModel(int roomAllocationId, int RoomStatusTypeId)
        {
            var newrec = false;
            if (roomAllocationId != 0)
            {
                var roomallocation = await _RoomAllocationRepository.GetById(roomAllocationId.ToString ());

                var statusdetail = roomallocation.RoomStatus_Detail.Where(status=> status.RoomStatusTypeId ==  RoomStatusTypeId).OrderByDescending(a => a.EnteredDate).FirstOrDefault();


                if (statusdetail == null)
                {
                    statusdetail = new RoomReservationSystem.Model.DAL.RoomStatus_Detail();
                    newrec = true;

                }
            
            
            RoomReservationSystem.ViewModels.RoomStatus_detailViewModel m = new RoomReservationSystem.ViewModels.RoomStatus_detailViewModel { newrec = newrec, RoomStatus_Detail = statusdetail };
            

            return PartialView("_roomstatusdetail", m);
            }else
             return Content("");
        }