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")); }
public Product UpdateProduct(ChangePriceDto dto) { var product = _context.Find <Product>(dto.ProductId); product.Price = dto.Price; _context.SaveChanges(); return(product); }