public ActionResult DeleteConfirmed(int id) { TercumeUser user = tercumeUserManager.Find(x => x.Id == id); tercumeUserManager.Delete(user); return(RedirectToAction("Index")); }
public string GetCurrentEmail() { TercumeUser user = CurrentSession.User; if (user != null) { return(user.Email); } else { return("system"); } }
public ActionResult Edit(TercumeUser user) { if (ModelState.IsValid) { BusinessLayerResult <TercumeUser> res = tercumeUserManager.Update(user); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(user)); } return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TercumeUser user = tercumeUserManager.Find(x => x.Id == id.Value); if (user == null) { return(HttpNotFound()); } return(View(user)); }
public ActionResult EditProfileUser(TercumeUser model, HttpPostedFileBase ProfileImage) { if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png")) { string filename = $"user_{model.Id}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/images/{filename}")); model.ProfileImageFilename = filename; } BusinessLayerResult <TercumeUser> res = tercumeUserManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorNotifyObj = new ErrorViewModel() { Items = res.Errors, Title = "Profil Güncellenemedi.", RedirectingUrl = "/Home/EditProfileUser" }; return(View("Error", errorNotifyObj)); } //Profil güncellendiği için session güncellendi. CurrentSession.Set <TercumeUser>("login", res.Result); return(RedirectToAction("ShowUserProfile")); } return(View(model)); }