public OperationResult Edit(ColleagueDiscountEdit edit) { var operation = new OperationResult(); var colleageDiscount = _colleagueDiscountRepository.GetById(edit.Id); if (colleageDiscount == null) { return(operation.Fail(ApplicationMessages.NotFoundRecord)); } if (_colleagueDiscountRepository.Exists(d => d.ProductId == edit.ProductId && d.DiscountRate == edit.DiscountRate && d.Id != edit.Id)) { return(operation.Fail(ApplicationMessages.DuplicateRecord)); } colleageDiscount.Edit(edit.ProductId, edit.DiscountRate); _colleagueDiscountRepository.SaveChanges(); return(operation.Success(ApplicationMessages.SuccessUpdate)); }
public JsonResult OnPostEdit(ColleagueDiscountEdit edit) { var result = _colleagueDiscountApplication.Edit(edit); return(new JsonResult(result)); }