public async Task <IActionResult> Edit(int id, [FromForm] EditShapeInput input) { var absolutePath = Path.Combine(_webHostEnvironment.WebRootPath, Shape.IMAGE_PATH); await _shapeService.Edit(id, input, absolutePath); return(Ok()); }
public async Task Edit(int id, EditShapeInput input, string imageFolderPath) { var shape = await Get(id); if (input.Image != null) { shape.Image = await Upload.UploadImageAsync(input.Image, imageFolderPath); } shape.Name = input.Name; shape.Status = input.Status; shape.Description = input.Description; await _shapeRepo.SaveChangesAsync(); }