public async Task <IServiceResponse <bool> > AddDiscount(DiscountDTO Discount) { return(await HandleApiOperationAsync(async() => { await _DiscountService.AddDiscount(Discount); return new ServiceResponse <bool>(true); })); }
public ActionResult AddDiscount(AdminPanelModel dis) { var ok_setup = _okss.GetAllOkSetups(); var roles = _rs.GetAllRoles(); ViewBag.Roles = roles; ViewBag.Ok_setup = ok_setup; var discount = _ds.GetAllDiscounts(); ViewBag.Discount = discount; if (ModelState.IsValid) { DiscountModel dm = new DiscountModel(); dm.Discount_Coef = dis.Discount_Coef; dm.Discount_Name = dis.Discount_Name; dm.Start_Date = dis.Start_Date; dm.End_Date = dis.End_Date; try { _ds.AddDiscount(dm); } catch (Exception ex) { ViewBag.AddOk_SetupMsg = ex.ToString(); } } else { ViewBag.Message = "Registration failed"; } ViewBag.TabIndex = "3"; return(View("Index")); }
public async Task <Unit> Handle(CreateDiscountCommand request, CancellationToken cancellationToken) { await _discountService.AddDiscount(request.Discount); return(Unit.Value); }
public async Task <IActionResult> PostDiscount([FromBody] Discount discount) { await _service.AddDiscount(discount); return(Ok()); }