public IActionResult Add(string ProductName, string ProductDetail, double Price, int Amount, IFormFile ImagePath) { modelProduct.Id = Guid.NewGuid().ToString(); modelProduct.ProductName = ProductName; modelProduct.ProductDetail = ProductDetail; modelProduct.Price = Price; modelProduct.Amount = Amount; modelProduct.ImagePath = ImagePath != null?UploadFile("storage-image-test", ImagePath) : ""; modelProduct.Created_at = DateTime.Now; var response = _apiService.AddProducts(modelProduct); if (response) { return(RedirectToAction("ManageProduct")); } else { return(RedirectToAction("Add")); } }