public ActionResult Edit(Personnels personnel, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedOnDatetime"); ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png")) { string filename = $"user_{personnel.Tc}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{filename}")); personnel.ProfileImage = filename; } BusinessLayerResult <Personnels> res = personnelManager.UpdatePersonnel(personnel); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); TaskDegreePositionListCreatOrEdit(personnel); return(View(personnel)); } CacheHelper.RemoveGetPersonnelsFromCache(); CacheHelper.RemoveGetActivePersonnelsFromCache(); return(RedirectToAction("Index")); } TaskDegreePositionListCreatOrEdit(personnel); return(View(personnel)); }