public ActionResult EditResume(EditResumeViewModel model, FormCollection fc) { try { if (ModelState.IsValid) { var user = _userManager.FindById(User.Identity.GetUserId()); var theResume = user.Resume; if (theResume == null) { theResume = resumeService.SaveNewResume(user, model); } else //update the existing resume { string previuosImgPath = user.Resume.ProfileImageUri; resumeService.UpdateExistingResume(theResume, model); if (System.IO.File.Exists(Server.MapPath(previuosImgPath))) { System.IO.File.Delete(Server.MapPath(previuosImgPath)); } } uow.Save(); return Json(new { status = "success", msg = "Successfully updated" }); } } catch (Exception ex) { FileLogger.LogError(ex); return Json(new { status = "error", msg = "an error occured" }); } return Json(new { status = "error", msg = "Please enter correct data" }); }