public async Task <IActionResult> DeletePrice(PriceCreationDto dto) { try { await _priceRepository.Delete(dto); return(Ok()); } catch (Exception e) { return(NotFound("This Price cannot be delete")); } }
public async Task <IActionResult> CreatePrice(PriceCreationDto dto) { var newPrice = new PriceCreationDto { NominalPrice = dto.NominalPrice, PromotionalPrice = dto.PromotionalPrice, DiscountPercentage = dto.DiscountPercentage }; await _priceRepository.Create(newPrice); return(Ok(dto)); }
public async Task <IActionResult> UpdatePrice(PriceCreationDto dto) { try { var update = new PriceCreationDto { NominalPrice = dto.NominalPrice, PromotionalPrice = dto.PromotionalPrice, DiscountPercentage = dto.DiscountPercentage }; await _priceRepository.Update(dto); return(Ok(update)); } catch (Exception e) { return(NotFound("This Price cannot be changed")); } }