public WholePrice(WholePriceViewModel wholePriceVm) { ProductId = wholePriceVm.ProductId; FromQuantity = wholePriceVm.FromQuantity; ToQuantity = wholePriceVm.ToQuantity; Price = wholePriceVm.Price; }
public async Task <IActionResult> Update([FromBody] WholePriceViewModel wholePriceVm) { var hasPermission = await _authorizationService.AuthorizeAsync(User, "PRODUCT", Operations.Update); if (hasPermission.Succeeded == false) { return(new BadRequestObjectResult(CommonConstants.Forbidden)); } if (ModelState.IsValid) { try { _wholePriceService.Update(wholePriceVm); _wholePriceService.SaveChanges(); return(new OkObjectResult(wholePriceVm)); } catch (Exception ex) { return(new BadRequestObjectResult(ex.Message)); } } return(new BadRequestObjectResult(ModelState)); }
public void Update(WholePriceViewModel wholePriceVm) { _wholePriceRepository.Update(_mapper.Map <WholePrice>(wholePriceVm)); }
public void Add(WholePriceViewModel wholePriceVm) { _wholePriceRepository.Add(_mapper.Map <WholePrice>(wholePriceVm)); }