public ActionResult Create() { var command = new CreateDiscountCommand(); FillControlls(command); return(View("Create", command)); }
public static Discount ToCreateEntity(this CreateDiscountCommand command) { var result = new Discount { DiscountType = command.DiscountType.ToLower(), DiscountPercentage = command.DiscountPercentage, IsPercentageType = command.IsPercentageType, DiscountAmount = command.DiscountAmount, }; return(result); }
public ActionResult Create(CreateDiscountCommand command) { if (!ModelState.IsValid) { FillControlls(command); return(View("Create")); } var result = _commandBus.Send(command); return(JsonMessage(result)); }
public async Task <IActionResult> CreateDiscount(CreateDiscountCommand command) { var result = await _mediator.Send(command); if (result.isSuccess) { return(Ok(new ApiResponse { ResponseCode = "00", ResponseDescription = result.message, Data = result.response })); } return(NotFound(new ApiResponse { ResponseCode = "01", ResponseDescription = result.message, Data = null })); }
public async Task CreateDiscount(CreateDiscountCommand createDiscountCommand) { await mediator.Send(createDiscountCommand); }