public async Task <IActionResult> Edit(int id, [FromForm] EditProductCategoryInput input) { var absolutePath = Path.Combine(_webHostEnvironment.WebRootPath, ProductCategory.IMAGE_PATH); await _productCateService.Edit(id, input, absolutePath); return(Ok()); }
public async Task Edit(int id, EditProductCategoryInput input, string imageFolderPath) { var proCate = await Get(id); if (input.Image != null) { proCate.Image = await Upload.UploadImageAsync(input.Image, imageFolderPath); } proCate.Name = input.Name; proCate.Status = input.Status; proCate.Url = input.Url; await _dbContext.SaveChangesAsync(); }