Esempio n. 1
0
        /// <summary>
        /// Get HotelRoomType manage model by id
        /// </summary>
        /// <param name="id">the HotelRoomType id</param>
        /// <returns></returns>
        public HotelRoomTypeManageModel GetHotelRoomTypeManageModel(int?id = null)
        {
            var hotelRoomType = GetById(id);

            if (hotelRoomType != null)
            {
                return(new HotelRoomTypeManageModel
                {
                    Id = hotelRoomType.Id,
                    Name = hotelRoomType.Name,
                    Description = hotelRoomType.Description,
                    Price = hotelRoomType.Price,
                    HotelRoomTypeServices = _hotelServiceServices.GetHotelRoomServices(hotelRoomType.Id),
                    RecordOrder = hotelRoomType.RecordOrder,
                    RecordActive = hotelRoomType.RecordActive
                });
            }
            return(new HotelRoomTypeManageModel
            {
                HotelRoomTypeServices = _hotelServiceServices.GetHotelRoomServices(),
            });
        }
Esempio n. 2
0
        public ActionResult Create(HotelRoomTypeManageModel model, SubmitTypeEnums submit)
        {
            if (ModelState.IsValid)
            {
                var response = _hotelRoomTypeServices.SaveHotelRoomTypeManageModel(model);
                if (response.Success)
                {
                    var templateId = (int)response.Data;
                    SetSuccessMessage(response.Message);
                    switch (submit)
                    {
                    case SubmitTypeEnums.Save:
                        return(RedirectToAction("Index"));

                    default:
                        return(RedirectToAction("Edit", new { id = templateId }));
                    }
                }
                SetErrorMessage(response.Message);
            }
            model.HotelRoomTypeServices = _hotelServiceServices.GetHotelRoomServices();
            return(View(model));
        }