Beispiel #1
0
        public static TypeOfHotelDTO MapTypeOfHotelDTO(TypeOfHotelViewModel typeOfHotel)
        {
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <TypeOfHotelViewModel, TypeOfHotelDTO>();
            });
            var mapper         = configuration.CreateMapper();
            var typeOfHotelDTO = mapper.Map <TypeOfHotelViewModel, TypeOfHotelDTO>(typeOfHotel);

            return(typeOfHotelDTO);
        }
Beispiel #2
0
 public ActionResult AddHotel(TypeOfHotelViewModel typeOfHotel)
 {
     if (Request.HttpMethod == "POST")
     {
         var typeOfHotelDto = MappingViewModel.MapTypeOfHotelDTO(typeOfHotel);
         _adminService.AddHotel(typeOfHotelDto);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View());
     }
 }