Beispiel #1
0
        public ActionResult DeleteRoomType(HotelRoomCategoryViewModel hotelRoomCategoryViewModel)
        {
            HotelRoomBind hotelRoomBind = AutoMapper.Mapper.Map <HotelRoomCategoryViewModel, HotelRoomBind>(hotelRoomCategoryViewModel);                 //Deleting Hotel Details

            hotelDetails.DeleteRoomType(hotelRoomBind.HotelRoomId);
            return(RedirectToAction("AddRoomCategory", "Hotel"));
        }
Beispiel #2
0
        public ActionResult UpdateRoomType([Bind(Exclude = "RoomCategory,Hotel")] HotelRoomCategoryViewModel hotelRoomCategoryViewModel)
        {
            Byte[]        bytes         = null;
            HotelRoomBind hotelRoomBind = new HotelRoomBind();

            if (hotelRoomCategoryViewModel.RoomImages != null)
            {
                Stream       fs = hotelRoomCategoryViewModel.RoomImages.InputStream;
                BinaryReader br = new BinaryReader(fs);
                bytes = br.ReadBytes((Int32)fs.Length);
                hotelRoomCategoryViewModel.RoomImage = bytes;
            }
            else
            {
                hotelRoomBind = hotelDetails.GetRoomCategoryDetail(hotelRoomCategoryViewModel.HotelRoomId);
                hotelRoomCategoryViewModel.RoomImage = hotelRoomBind.RoomImage;
            }
            hotelRoomCategoryViewModel.UploadDate = DateTime.Now;
            hotelRoomBind = AutoMapper.Mapper.Map <HotelRoomCategoryViewModel, HotelRoomBind>(hotelRoomCategoryViewModel);                 //Updating Hotel Details
            hotelDetails.UpdateRoomType(hotelRoomBind);
            if (User.IsInRole("Admin"))
            {
                return(RedirectToAction("ManageHotel", "Hotel", new { Approved = "Approved" }));
            }
            else
            {
                return(RedirectToAction("ManageHotel", "Hotel", new { MyHotel = "MyHotel" }));
            }
        }
Beispiel #3
0
        public ActionResult AddRoomCategory(HotelRoomCategoryViewModel category)
        {
            category.HotelId = (int)TempData["HotelId"];
            List <RoomCategory>   roomCategory = hotelDetails.GetCategory();
            List <SelectListItem> categoryList = new List <SelectListItem>();

            foreach (RoomCategory detail in roomCategory)                           //For Getting list of Categories
            {
                categoryList.Add(new SelectListItem {
                    Text = @detail.RoomType, Value = @detail.RoomId.ToString()
                });
            }
            ViewBag.list = categoryList;
            List <HotelRoomBind> list = hotelDetails.GetRoomCategoryDetails(category.HotelId);
            List <HotelRoomCategoryViewModel> hotelRoomList = new List <HotelRoomCategoryViewModel>();

            foreach (HotelRoomBind detail in list)
            {
                HotelRoomCategoryViewModel hotelRoomCategoryViewModel = AutoMapper.Mapper.Map <HotelRoomBind, HotelRoomCategoryViewModel>(detail);
                hotelRoomList.Add(hotelRoomCategoryViewModel);
            }
            RoomViewModel roomViewModel = new RoomViewModel();

            roomViewModel.HotelRoomCategoryViewModel  = category;
            roomViewModel.HotelRoomCategoryViewModels = hotelRoomList;
            Hotel hotel = hotelDetails.GetHotelDetailsById(category.HotelId);

            roomViewModel.HotelViewModel = AutoMapper.Mapper.Map <Hotel, HotelViewModel>(hotel);
            return(View(roomViewModel));
        }
        // GET: HotelDetails
        public ActionResult AddRoomCategory()
        {
            HotelRoomCategoryViewModel category = new HotelRoomCategoryViewModel();
            //category.HotelRoomCategoryId = (int)TempData["HotelRoomCategoryId"];
            List <RoomCategory>   roomCategory = hotelDetails.GetCategory();
            List <SelectListItem> categoryList = new List <SelectListItem>();

            foreach (RoomCategory detail in roomCategory)
            {
                categoryList.Add(new SelectListItem {
                    Text = @detail.RoomType, Value = @detail.RoomId.ToString()
                });
            }
            ViewBag.List = categoryList;
            return(View());
        }
Beispiel #5
0
        public ActionResult EditRoomType(HotelRoomCategoryViewModel hotelRoomCategoryViewModel)
        {
            List <RoomCategory>   roomCategory = hotelDetails.GetCategory();
            List <SelectListItem> categoryList = new List <SelectListItem>();

            foreach (RoomCategory detail in roomCategory)                           //For Getting list of Categories
            {
                categoryList.Add(new SelectListItem {
                    Text = @detail.RoomType, Value = @detail.RoomId.ToString()
                });
            }
            ViewBag.list = categoryList;
            HotelRoomBind hotelRoomBind = hotelDetails.GetRoomTypeDetails(hotelRoomCategoryViewModel.HotelRoomId);

            hotelRoomCategoryViewModel = AutoMapper.Mapper.Map <HotelRoomBind, HotelRoomCategoryViewModel>(hotelRoomBind);
            return(View(hotelRoomCategoryViewModel));
        }
Beispiel #6
0
        public ActionResult AddRoomCategory(RoomViewModel roomViewModel, HotelRoomCategoryViewModel hotelRoomCategoryViewModel, string Save)
        {
            Byte[] bytes = null;
            if (roomViewModel.RoomImages.FileName != null)
            {
                Stream       fs = roomViewModel.RoomImages.InputStream;
                BinaryReader br = new BinaryReader(fs);
                bytes = br.ReadBytes((Int32)fs.Length);
                roomViewModel.HotelRoomCategoryViewModel.RoomImage  = bytes;
                roomViewModel.HotelRoomCategoryViewModel.UploadDate = DateTime.Now;
            }
            TempData["HotelId"] = roomViewModel.HotelRoomCategoryViewModel.HotelId;
            List <RoomCategory>   list         = hotelDetails.GetCategory();
            List <SelectListItem> categoryList = new List <SelectListItem>();

            foreach (RoomCategory details in list)
            {
                categoryList.Add(new SelectListItem {
                    Text = @details.RoomType, Value = @details.RoomId.ToString()
                });
            }
            ViewBag.List = categoryList;
            if (ModelState.IsValid)
            {
                HotelRoomBind hotel = AutoMapper.Mapper.Map <HotelRoomCategoryViewModel, HotelRoomBind>(roomViewModel.HotelRoomCategoryViewModel);
                hotelDetails.AddRoomCategoryForHotel(hotel);                                            //Adding RoomCategories
                TempData["HotelId"] = hotel.HotelId;
                if (Save != null)
                {
                    if (User.IsInRole("Admin"))
                    {
                        return(RedirectToAction("ManageHotel", "Hotel", new { Approved = "Approved" }));
                    }
                    else
                    {
                        return(RedirectToAction("ManageHotel", "Hotel", new { MyHotel = "MyHotel" }));
                    }
                }
                return(RedirectToAction("AddRoomCategory", "Hotel"));
            }
            return(View(roomViewModel));
        }
        public ActionResult AddRoomCategory(HotelRoomCategoryViewModel hotelRoomCategory)
        {
            List <RoomCategory>   list         = hotelDetails.GetCategory();
            List <SelectListItem> categoryList = new List <SelectListItem>();

            foreach (RoomCategory details in list)
            {
                categoryList.Add(new SelectListItem {
                    Text = @details.RoomType, Value = @details.RoomId.ToString()
                });
            }
            if (ModelState.IsValid)
            {
                HotelRoomBind hotel = AutoMapper.Mapper.Map <HotelRoomCategoryViewModel, HotelRoomBind>(hotelRoomCategory);
                hotelDetails.AddRoomCategoryForHotel(hotel);
                return(RedirectToAction("ManageHotel", "Admin"));
            }
            //ViewBag.RoomCategory = new SelectList(HotelRepository.GetCategories(), "RoomId", "RoomType");
            return(View());
        }
Beispiel #8
0
        public ActionResult BookHotel(HotelTimingViewModel hotelTimingViewModel, HotelRoomCategoryViewModel hotelRoom)
        {
            ViewBag.A            = TempData["CheckIn"];
            ViewBag.B            = TempData["CheckOut"];
            TempData["CheckIn"]  = ViewBag.A;
            TempData["CheckOut"] = ViewBag.B;
            hotelTimingViewModel.BookViewModel             = new BookViewModel();
            hotelTimingViewModel.BookViewModel.HotelRoomId = hotelRoom.HotelRoomId;
            if (TempData["CheckIn"] != null)
            {
                hotelTimingViewModel.BookViewModel.CheckIn  = Convert.ToDateTime(TempData["CheckIn"]); //DateTime.Parse(a);
                hotelTimingViewModel.BookViewModel.CheckOut = Convert.ToDateTime(TempData["CheckIn"]); //DateTime.Parse(b);
            }
            hotelTimingViewModel.BookViewModel.UserId = HttpContext.User.Identity.Name;
            HotelRoomBind hotelRooms = hotelDetails.GetRoomCategoryDetail(hotelRoom.HotelRoomId);
            Hotel         hotel      = hotelDetails.GetHotelDetailsById(hotelRooms.HotelId);

            hotelTimingViewModel.HotelViewModel             = AutoMapper.Mapper.Map <Hotel, HotelViewModel>(hotel);
            hotelTimingViewModel.HotelRoomCategoryViewModel = AutoMapper.Mapper.Map <HotelRoomBind, HotelRoomCategoryViewModel>(hotelRooms);
            hotelTimingViewModel.HotelRoomCategoryViewModel.RoomCategories = new RoomCategory();
            hotelTimingViewModel.HotelRoomCategoryViewModel.RoomCategories = (hotelDetails.GetCategoryById(hotelTimingViewModel.HotelRoomCategoryViewModel.RoomId));
            return(View(hotelTimingViewModel));
        }