public IActionResult RemoveProduct(int productId) { var product = _repository.GetProductById(productId); if (product == null) { return(NotFound("Cannot find the specified product.")); } _repository.RemoveEntity(product); if (_repository.SaveChanges()) { return(RedirectToAction("AdminPage", "AdminPage")); } return(BadRequest("Cannot save the changes to the database.")); }