public async Task <IActionResult> Edit(PersonEditViewModel model) { if (ModelState.IsValid) { var path = model.ImageUrl; if (model.ImageFile != null) { path = await _imageHelper.UploadImageAsync(model.ImageFile, "People"); } try { var mechanic = _converterHelper.ToMechanicEdit(model, path); await _mechanicRepository.UpdateAsync(mechanic); ViewBag.UserMessage = "User Sucessfully Updated!"; } catch (DbUpdateConcurrencyException) { if (!await _mechanicRepository.ExistAsync(model.Id)) { return(NotFound()); } else { throw; } } return(View(model)); } return(View(model)); }