public void Update(RestaurantFoodDTO modelDTO, IFormFile file) { var model = _mapper.Map <RestaurantFood>(modelDTO); Errors.ThrowIfNull(model); if (file != null) { model.PathToImage = UpdateFile(file); } _db.Update(model); }
public async Task <IActionResult> Put( [FromForm][ModelBinder(BinderType = typeof(FormDataJsonBinder))] RestaurantFoodDTO model, [FromForm] IFormFile file) { if (model == null) { return(BadRequest()); } _foodService.Update(model, file); await _foodService.SaveDataBase(); return(Ok()); }