Пример #1
0
        public IActionResult ChangePrice(ChangePriceDto dto)  //the ChangePubDateDto is received from the above method
        {
            var service = new ChangePriceService(_context);

            service.UpdateProduct(dto);

            return(View("ProductUpdated", "Successfully changed publication date"));
        }
Пример #2
0
        public Product UpdateProduct(ChangePriceDto dto)
        {
            var product = _context.Find <Product>(dto.ProductId);

            product.Price = dto.Price;
            _context.SaveChanges();
            return(product);
        }