public ActionResult Edit(Registration registration) { if (registration.Cvpath != null) { string exfilename = Server.MapPath(registration.Cvpath); if ((System.IO.File.Exists(exfilename))) { System.IO.File.Delete(exfilename); } string fileName = Path.GetFileNameWithoutExtension(registration.Cv.FileName); string extention = Path.GetExtension(registration.Cv.FileName); string newfilename = registration.FullName + extention; registration.Cvpath = "~/Cv/" + newfilename; registration.Cv.SaveAs(Path.Combine(Server.MapPath("~/Cv/"), newfilename)); } Registration modifieddata = new Registration() { UserId = registration.UserId, FullName = registration.FullName, Email = registration.Email, Cvpath = registration.Cvpath }; lodinDb.modifie(modifieddata.UserId, modifieddata.FullName, modifieddata.Email, modifieddata.Cvpath); return(Content(registration.Email)); }