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); }
public JsonResult Createroomtype(CreateRoomTypeRequest request) { if (string.IsNullOrEmpty(request.roomtypename)) { return(new NewJsonResult(new Baseresponse { Success = 0, Message = "请填写名称" })); } decimal price = 0; if (!decimal.TryParse(request.ealryprice, out price) || !decimal.TryParse(request.roomtypeprice, out price) || !decimal.TryParse(request.zmmoney, out price)) { return(new NewJsonResult(new Baseresponse { Success = 0, Message = "请填写正确的金额" })); } generateService.Addroom_type(new room_typeDto { hotelid = UserInfo.hotelid, room_Bfb = request.bfb, room_ealry_price = decimal.Parse(request.ealryprice), room_hour = request.roomhour, room_name = request.roomtypename, room_zmmoney = decimal.Parse(request.zmmoney), room_image = string.Empty, room_Moth_price = 0, room_number = string.Empty, room_reamker = request.remark, room_hourmation = string.Empty, room_listedmoney = decimal.Parse(request.roomtypeprice) }); return(new NewJsonResult(new Baseresponse { Success = 1, Message = "添加成功" })); }
public JsonResult Save([FromBody] CreateRoomTypeRequest model) { ActionsResult result; result = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/roomtypes/save", model); return(Json(new { result })); }
public async Task <ActionsResult> Save(CreateRoomTypeRequest roomType) { return(await roomTypeService.Save(roomType)); }