public async Task <ActionsResult> Save(SavePromotionRequest request) { var promotion = new Promotion() { PromotionId = request.PromotionId, DiscountRates = request.DiscountRates, EndDate = request.EndDate, PromotionName = request.PromotionName, StartDate = request.StartDate }; var createPromotionResult = await promotionRepository.Save(promotion); if (createPromotionResult.Id != 0) { foreach (var roomTypeId in request.RoomTypeIds) { _ = await promotionApplyRepository.Save(new PromotionApply() { RoomTypeId = int.Parse(roomTypeId), PromotionId = createPromotionResult.Id }); } } return(createPromotionResult); }
public JsonResult Save([FromBody] SavePromotionRequest model) { ActionsResult result; result = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/promotions/save", model); return(Json(new { result })); }
public async Task <ActionsResult> Save(SavePromotionRequest promotion) { return(await promotionService.Save(promotion)); }