public string GetUsername() { EvernoteUser user = SessionManager.User; string name = (user != null) ? user.UserName : "******"; return(name); }
public ActionResult DeleteProfile() { EvernoteUser currentUser = CurrentSession.User; if (currentUser != null) { BusinessLayerResult <EvernoteUser> blr = eum.RemoveUserById(currentUser.Id); if (blr.Errors.Count > 0) { ErrorViewModel errorModel = new ErrorViewModel() { RedirectingPageName = "Profilim", RedirectingUrl = "/Home/ShowProfile" }; blr.Errors.ForEach(x => errorModel.Items.Add(x.Value)); return(View("Error", errorModel)); } Session.Clear(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult EditProfile(EvernoteUser model, HttpPostedFileBase ProfileImage) { 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; } BusinessLayer.EvernoteUserManager eum = new EvernoteUserManager(); BusinessLayerResult <EvernoteUser> res = eum.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorNotifyObj = new ErrorViewModel() { Items = res.Errors, Title = "Profil Güncellenemedi.", RedirectingUrl = "/Home/EditProfile" }; return(View("Error", errorNotifyObj)); } Session["login"] = res.Result; return(RedirectToAction("ShowProfile")); }
public ActionResult EditProfile() { EvernoteUser currentUser = CurrentSession.User; if (currentUser != null) { EvernoteUserManager eum = new EvernoteUserManager(); BusinessLayerResult <EvernoteUser> blr = eum.GetUserById(currentUser.Id); if (blr.Errors.Count > 0) { ErrorViewModel errorModel = new ErrorViewModel(); blr.Errors.ForEach(x => { errorModel.Items.Add(x.Value); }); return(View("Error", errorModel)); } else { return(View(blr.Result)); } } return(RedirectToAction("Login")); }
public ActionResult EditProfile(EvernoteUser model, HttpPostedFileBase ProfileImage, string txtNewPass) { ModelState.Remove("ModifiedUsername"); // bunun ile alakalı bir validation kontrolu yapılmasını istemiyorsan 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; } model.Password = MD5Encryption.MD5Sifrele(txtNewPass.ToString()); BusinessLayerResult <EvernoteUser> res = eum.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorNotify = new ErrorViewModel() { Title = "Profile Güncellenemedi.", Items = res.Errors, RedirectingUrl = "/Home/EditProfile" }; return(View("Error", errorNotify)); } CurrentSession.Set <EvernoteUser>("login", res.Result);// Profil güncellendiği için session güncellendi.. return(RedirectToAction("ShowProfile")); } return(View(model)); }
public BusinessLayerResult <EvernoteUser> RegisterUser(RegisterViewModel model) { EvernoteUser user = repo_user.Find(x => x.UserName == model.kullaniciAdi || x.Email == model.ePosta); BusinessLayerResult <EvernoteUser> layerResult = new BusinessLayerResult <EvernoteUser>(); if (user != null) { if (model.kullaniciAdi == user.UserName) { layerResult.Errors.Add("Kullanıcı adı kayıtlı."); } if (model.ePosta == user.Email) { layerResult.Errors.Add("E-posta kayıtlı."); } } else { int dbResult = repo_user.Insert(user); if (dbResult > 0) { //TODO : Aktivasyon emaili yollanacak } } return(layerResult); }
[Auth] //filter ekledik.giriş yapmamışsa yönlendirme yapıyoruz bu classta(Filters klasöründe)(authenticationfilterlogin) public ActionResult DeleteProfile() { EvernoteUser currentUser = Session["login"] as EvernoteUser; EvernoteUserManager eum = new EvernoteUserManager(); BusinessLayerResult <EvernoteUser> res = eum.RemoveUserById(currentUser.Id); if (res.Errors.Count > 0) { ErrorViewModel errorNotifyObj = new ErrorViewModel() { Items = res.Errors, Title = "Profil Silinemedi.", RedirectingUrl = "/Home/ShowProfile" //yönlendir. }; return(View("Error", errorNotifyObj)); } //sessionı sil. Session.Clear(); return(RedirectToAction("Index")); }
public ActionResult UpdateProfileImage(EvernoteUser model, HttpPostedFileBase ProfileImage) { 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; BuisnessLayerResult <EvernoteUser> res = evernoteUserManager.UpdatePersonImage(model); if (res.Errors.Count > 0) { errorObject.Title = "Kullanıcı Bulunamadı! "; errorObject.Items = res.Errors; return(View("Error", errorObject)); } CSession.Set("login", res.Result); return(RedirectToAction("ShowProfile", new { id = res.Result.ID })); } errorObject.Title = "Yalnızca JPEG,JPG Ve PNG Formatında Yükleme Yapabilirsiniz! "; return(View("Error", errorObject)); }
public ActionResult EditProfile(EvernoteUser model) { ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { BusinessLayerResult <EvernoteUser> res = eum.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorNotifyObj = new ErrorViewModel() { Items = res.Errors, Title = "Profil Güncellenemedi.", RedirectingUrl = "/Home/EditProfile" }; return(View("Error", errorNotifyObj)); } // Profil güncellendiği için session güncellendi. CurrentSession.Set <EvernoteUser>("login", res.Result); return(RedirectToAction("ShowProfile")); } return(View(model)); }
public ActionResult EditProfile(EvernoteUser user, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/png")) { string fileName = $"user_{user.Id}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{fileName}")); user.ProfileImageFileName = fileName; } BusinessLayerResult <EvernoteUser> res = _userManager.UpdateProfile(user); if (res.Errors.Count > 0) { ErrorViewModel errorNotify = new ErrorViewModel() { Title = "Profil Güncellenemedi.", Items = res.Errors, RedirectingUrl = "/home/editprofile" }; return(View("Error", errorNotify)); } CurrentSession.Set <EvernoteUser>("login", res.Result); return(RedirectToAction("ShowProfile")); } return(View(user)); }
public ActionResult DeleteConfirmed(int id) { EvernoteUser evernoteUser = evernoteUserManager.Find(x => x.Id == id); evernoteUserManager.Delete(evernoteUser); return(RedirectToAction("Index")); }
public ActionResult EditProfile(EvernoteUser model, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/png")) { string filename = $"user_{model.Id}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{filename}")); model.ProfileImageFileName = filename; } BusinessLayerManager <EvernoteUser> res = evernoteUserManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel message = new ErrorViewModel() { Items = res.Errors, Title = "Profile Güncellenemedi.", RedicrtingUrl = "/Home/EditProfile", RedirectingTimeout = 5000 }; return(View("Error", message)); } Session["Login"] = res.Result; return(RedirectToAction("ShowProfile")); } return(View(model)); }
public ActionResult DeleteProfile(EvernoteUser user) { // BusinessLayerResult<EvernoteUser> res = eum.RemoveUserById(CurrentSession.User.Id); BusinessLayerResult <EvernoteUser> res1 = eum.GetUserById(CurrentSession.User.Id); res1.Result.IsDelete = true; BusinessLayerResult <EvernoteUser> res2 = eum.Update(res1.Result); if (res2.Errors.Count > 0) { ErrorViewModel errorNotifyObj = new ErrorViewModel() { Items = res2.Errors, Title = "Profil Silinemedi.", RedirectingUrl = "/Home/ShowProfile" }; return(View("Error", errorNotifyObj)); } Session.Clear(); return(RedirectToAction("Index")); }
public ActionResult EditProfile(EvernoteUser data, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedUser"); if (ModelState.IsValid) { if (ProfileImage != null && (ProfileImage.ContentType == "image/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png")) { string filename = $"user_{data.ID}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Content/images/{filename}")); data.ImagesFileName = filename; } Result <EvernoteUser> res = eum.UpdateProfile(data); if (res.Errors.Count > 0) { ErrorViewModel err = new ErrorViewModel() { Title = "Geçersiz İşlem", Items = res.Errors, RedirectingUrl = "/Profile/EditProfile" }; return(View("Error", err)); } SessionManager.Set <EvernoteUser>("login", res.Results); //Profil güncellendiği için Sessionda da güncelleme yapılır. return(RedirectToAction("ShowProfile")); } return(View(data)); }
public ActionResult EditProfile(EvernoteUser model, HttpPostedFileBase ProfileImage) { ModelState.Remove("ModifiedUserName"); 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 <EvernoteUser> res = evernoteUserManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorNotifyOBj = new ErrorViewModel() { Items = res.Errors, Title = "Profile Güncellenemedi", RedirectingUrl = "/Home/EditProfile" }; return(View("Error", errorNotifyOBj)); } CurrentSession.Set <EvernoteUser>("login", res.Result);// Profile güncellendiği için session güncellendi. return(RedirectToAction("ShowProfile")); } return(View(model)); }
public void TestDelete() { EvernoteUser user = repo_user.Find(x => x.Username == "ayilmaz"); if (user != null) { int result = repo_user.Delete(user); } }
public ActionResult MyMostLikedNote() { EvernoteUser user = CSession.User; TempData["MyMostLikedNote"] = likedManager.ListQueryable().Where(x => x.LikedUser.ID == user.ID).Select(x => x.Note).ToList(); return(RedirectToAction("Index", "Home")); }
public void DeleteTest() { EvernoteUser user = userRepo.Find(x => x.Name == "abc"); if (user != null) { int result = userRepo.Delete(user); } }
public void DeleteTest() { EvernoteUser user = repo_user.Find(x => x.Username == "xxx"); if (user != null) { repo_user.Delete(user); } }
public void DeleteTest() { EvernoteUser username = repo_user.Find(x => x.Username == "mizginbayam"); if (username != null) { repo_user.Delete(username); } }
public string GetCurrentUsername() { if (HttpContext.Current.Session["login"] != null) { EvernoteUser user = HttpContext.Current.Session["login"] as EvernoteUser; return(user.Username); } return("system"); }
public void DeleteTest() { EvernoteUser user = repo_user.Find(x => x.Username == "test"); if (user != null) { int result = repo_user.Delete(user); } }
public ActionResult SendLiked(int?nID, bool state) { Note note = null; EvernoteUser user = null; int?lID = CSession.User.ID; note = noteManager.Find(x => x.ID == nID); user = userManager.Find(x => x.ID == lID); int count = 0; if (nID != null && lID != null) { if (note != null && user != null) { if (state) { Liked Liked = likedManager.Find(x => x.LikedUser.ID == lID && x.Note.ID == note.ID); count = likedManager.Delete(Liked); if (count > 0) { note.likeCount = note.likeCount - 1; noteManager.Update(note); return(Json(new { status = true, likedCount = note.likeCount })); } } else { Liked liked = new Liked(); liked.LikedUser = user; liked.Note = note; count = likedManager.insert(liked); if (count > 0) { note.likeCount = note.likeCount + 1; noteManager.Update(note); return(Json(new { status = true, likedCount = note.likeCount })); } } return(Json(new { status = false, text = "Beğendiğiniz Not Silinmiş Olabilir!" })); } return(Json(new { status = false, text = "Beğendiğiniz Not Silinmiş Olabilir!" })); } return(Json(new { status = false, text = "Beğendiğiniz Not Silinmiş Olabilir!" })); }
public void TestUpdate() { EvernoteUser user = repo_user.Find(x => x.Username == "ayilmaz"); if (user != null) { user.Username = "******"; int result = repo_user.Save(); } }
public string GetCurrentUsername() { EvernoteUser user = CurrentSession.User; if (user != null) { return(user.Username); } return("system"); }
public void UpdateTest() { EvernoteUser user = repo_user.Find(x => x.UserName == "ewqwq"); if (user != null) { user.UserName = "******"; int result = repo_user.Update(user); } }
public void UpdateTest() { EvernoteUser user = repo_user.Find(x => x.Username == "Test"); if (user != null) { user.Name = "yyyyy"; int result = repo_user.Update(user); } }
public void UpdateTest() { EvernoteUser user = repo_user.Find(x => x.Username == "CemilYamak"); if (user != null) { user.Username = "******"; int result = repo_user.Update(user); } }
public void Update() { EvernoteUser user = repo_user.Find(x => x.Username == "abj"); if (repo_user != null) { user.Username = "******"; int result = repo_user.Update(user); } }
public void UpdateTest() { EvernoteUser user = repo_user.Find(x => x.Username == "qqwww"); if (user != null) { user.Username = "******"; int result = repo_user.Save(); } }