public async Task <ActionsResult> Save(CreateRoomTypeRequest roomType)
        {
            var createRoomtype = new RoomType()
            {
                RoomTypeId   = roomType.RoomTypeId,
                DefaultPrice = roomType.DefaultPrice,
                Description  = roomType.Description,
                Name         = roomType.Name,
                Quantity     = roomType.Quantity,
                MaxAdult     = roomType.MaxAdult,
                MaxChildren  = roomType.MaxChildren,
                MaxPeople    = roomType.MaxPeople
            };
            var createRoomtypeResult = await roomTypeRepository.Save(createRoomtype);

            if (createRoomtypeResult.Id != 0)
            {
                _ = await roomTypeImageRepository.Save(new UploadRoomTypeImagesRequest()
                {
                    Images     = roomType.Images,
                    RoomTypeId = createRoomtypeResult.Id
                });

                _ = await facilityApplyRepository.Save(new CreateRoomTypeFacilitiesApplyRequest()
                {
                    RoomTypeId   = createRoomtypeResult.Id,
                    FacilitieIds = roomType.Facilities
                });
            }
            return(createRoomtypeResult);
        }
示例#2
0
 public async Task <ActionsResult> Save(UploadRoomTypeImagesRequest roomTypeImage)
 {
     return(await roomTypeImageRepository.Save(roomTypeImage));
 }