public ActionResult LoginTercuman(LoginViewModelTranslator model) { if (ModelState.IsValid) { BusinessLayerResult <Tercuman> res = tercumanManager.LoginTranslator(model); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(model)); } CurrentSessionsTercuman.Set <Tercuman>("login", res.Result); // Session'a kullanıcı bilgi saklama.. return(RedirectToAction("IndexTercuman")); // yönlendirme.. } return(View(model)); }
public ActionResult EditProfileTercuman(Tercuman 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 <Tercuman> res = tercumanManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModelTercuman errorNotifyObj = new ErrorViewModelTercuman() { Items = res.Errors, Title = "Profil Güncellenemedi.", RedirectingUrl = "/Home/EditProfileTercuman" }; return(View("ErrorTercuman", errorNotifyObj)); } //Profil güncellendiği için session güncellendi. CurrentSessionsTercuman.Set <Tercuman>("login", res.Result); return(RedirectToAction("ShowTercumanProfile")); } return(View(model)); }
public ActionResult LogoutUser() { CurrentSessionsTercuman.Clear(); return(RedirectToAction("Index")); }