public ActionResult DeleteConfirmed(int id) { EverNoteUser everNoteUser = evernoteUserManager.Find(x => x.Id == id); evernoteUserManager.Delete(everNoteUser); return(RedirectToAction("Index")); }
public BusinessLayerResult <EverNoteUser> UpdateProfile(EverNoteUser user) { EverNoteUser db_user = repo_user.Find(x => x.Id != user.Id && (x.UserName == user.UserName || x.Email == user.Email)); BusinessLayerResult <EverNoteUser> res = new BusinessLayerResult <EverNoteUser>(); if (db_user != null && db_user.Id != user.Id) { if (db_user.UserName == user.UserName) { res.AddError(ErrorMessageCode.UserNameAlreadyExist, "Bu kullanıcı daha önce oluşturulmuş."); } if (db_user.Email == user.Email) { res.AddError(ErrorMessageCode.EmailAlreadyExist, "Bu e-posta daha önce kullanılmış."); } return(res); } res.Result = repo_user.Find(x => x.Id == user.Id); res.Result.Email = user.Email; res.Result.Name = user.Name; res.Result.Surname = user.Surname; res.Result.Password = user.Password; res.Result.UserName = user.UserName; if (string.IsNullOrEmpty(user.ProfileImageFileName) == false) { res.Result.ProfileImageFileName = user.ProfileImageFileName; } if (repo_user.Update(res.Result) == 0) { res.AddError(ErrorMessageCode.ProfileCouldNotUpdate, "Profil Güncellenemedi."); } return(res); }
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 = repoUser.Find(x => x.Username == "xxx"); if (user != null) { int result = repoUser.Delete(user); } }
public void DeleteTest() { EverNoteUser user = repo_user.Find(x => x.UserName == "yasina"); if (user != null) { repo_user.Delete(user); } }
public void DeleteTest() { EverNoteUser user = repo_user.Find(x => x.Username == "fuatozerr"); if (user != null) { user.Username = "******"; int result = repo_user.Delete(user); } }
public ActionResult Index() { EverNoteUser user = CurrentSession.User; var notes = noteManager.ListQueryable().Include("Category").Include("Owner").Where( x => x.Owner.Id == user.Id).OrderByDescending( x => x.ModifiedOn); return(View(notes.ToList())); }
public void UpdateTest() { EverNoteUser user = repoUser.Find(x => x.Username == "aabb"); if (user != null) { user.Username = "******"; int result = repoUser.Update(user); } }
public void UpdateTest() { EverNoteUser user = repo_user.Find(x => x.Name == "Yasin"); if (user != null) { user.UserName = "******"; repo_user.Update(user); } }
public void UpdateTest() { EverNoteUser user = repo_user.Find(x => x.Name == "Muhammet"); if (user != null) { user.UserName = "******"; repo_user.Update(user); } }
public ActionResult EditProfile() //bununla sayfa oluşuyor. { EverNoteUser currentUser = Session["login"] as EverNoteUser; //loginin içinden bütün bilgileri evernoteuser'a çevirerek currentuser'a atacak. EverNoteUserManager eum = new EverNoteUserManager(); BusinessLayerResult <EverNoteUser> res = eum.GetUserById(currentUser.Id); if (res.Errors.Count > 0) { } return(View(res.Result)); }
public ActionResult ShowProfile() { EverNoteUser currentUser = Session["login"] as EverNoteUser; EverNoteUserManager eum = new EverNoteUserManager(); BusinessLayerResult <EverNoteUser> res = eum.GetUserById(currentUser.Id); if (res.Errors.Count > 0) { //kullanıcıyı hata ekranına gönder. } return(View(res.Result)); }
public string GetCurrentUsername() { EverNoteUser user = CurrentSession.User; if (user != null) { return(user.Username); } else { return("system"); } }
public string GetCurrentUsername() { EverNoteUser user = CurrentSession.User; if (user != null) { return(user.Username); } else { return("fuatotomatik"); } //return null; }
// GET: EverNoteUser/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EverNoteUser everNoteUser = userManager.Find(x => x.Id == id.Value); if (everNoteUser == null) { return(HttpNotFound()); } return(View(everNoteUser)); }
public void CommentTest() { EverNoteUser user = repoUser.Find(x => x.Id == 1); Note note = repoNote.Find(x => x.Id == 1); Comment comment = new Comment() { Text = "Test Comment", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", Note = note, Owner = user }; repoComment.Insert(comment); }
public void CommentTest() { EverNoteUser user = repo_user.Find(x => x.Id == 1); Note note = repo_note.Find(x => x.Id == 3); Comment comment = new Comment() { Text = "Bu bir testtir", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", Note = note, Owner = user }; repo_comment.Insert(comment); }
public ActionResult Edit(EverNoteUser evernoteUser) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedOn"); ModelState.Remove("ModifiedUsername"); if (ModelState.IsValid) { BusinessLayetResult <EverNoteUser> res = evernoteUserManager.Update(evernoteUser); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(evernoteUser)); } return(RedirectToAction("Index")); } return(View(evernoteUser)); }
public BusinessLayerResult <EverNoteUser> RegisterUser(RegisterViewModel data) { BusinessLayerResult <EverNoteUser> layerResult = new BusinessLayerResult <EverNoteUser>(); EverNoteUser user = repo_user.Find(x => x.Username == data.Username || x.Email == data.Email); if (user != null) { if (user.Username == data.Username) { layerResult.AddError(ErrorMessageCode.UsernameAlreadyExists, "Kullanıcı adı kayıtlı"); } if (user.Email == data.Email) { layerResult.AddError(ErrorMessageCode.EmailAlreadyExists, "Email kayıtlı"); } } else { int dbResult = repo_user.Insert(new EverNoteUser() { Username = data.Username, Email = data.Email, Password = data.Password, ActivateGuid = Guid.NewGuid(), IsActive = false, IsAdmin = false }); if (dbResult > 0) { layerResult.Result = repo_user.Find(x => x.Email == data.Email && x.Username == data.Username); string siteUri = ConfigHelper.Get <string>("SiteRootUri"); string activateUri = $"{siteUri}/Home/UserActivate/{layerResult.Result.ActivateGuid}"; string body = ($"Merhaba{layerResult.Result.Username} <br><br> Hesabınızı aktifleştirmek için <a href='{activateUri}' target='_blank'>tıklayınız</a>."); MailHelper.SendMail(body, layerResult.Result.Email, "MyEverNote Hersap Aktifleştirme"); } } return(layerResult); }
public ActionResult Create(EverNoteUser everNoteUser) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedUserName"); ModelState.Remove("ModifiedOn"); if (ModelState.IsValid) { BusınessLayerResult <EverNoteUser> res = userManager.Insert(everNoteUser); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(everNoteUser)); } return(RedirectToAction("Index", "EverNoteUser")); } return(View(everNoteUser)); }
public ActionResult EditProfile(EverNoteUser model, HttpPostedFileBase ProfileImage) { ModelState.Remove("CreatedOn"); ModelState.Remove("ModifiedUserName"); ModelState.Remove("ModifiedOn"); 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; } UserManager um = new UserManager(); BusınessLayerResult <EverNoteUser> res = um.UpdateUser(model); if (res.Errors.Count > 0) { //Kullanıcı Hata Ekranına Yönlendirilir; ErrorViewModel errorViewModel = new ErrorViewModel() { Title = "Güncelleme Başarısız", ıtems = res.Errors, RedirectingUrl = "/Home/EditProfile" }; return(View("Error", errorViewModel)); } 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/jpeg" || ProfileImage.ContentType == "image/jpg" || ProfileImage.ContentType == "image/png")) { string fileName = $"user_{user.Id}.{ProfileImage.ContentType.Split('/')[1]}"; ProfileImage.SaveAs(Server.MapPath($"~/Images/{fileName}")); user.ProfilImageFileName = fileName; } EverNoteUserManager eum = new EverNoteUserManager(); BusinessLayerResult <EverNoteUser> res = eum.UpdateProfile(user); if (res.Errors.Count > 0) { } Session["login"] = res.Result; return(RedirectToAction("ShowProfile")); } return(View(user)); }
public void Seed2(DatabaseContext context) { EverNoteUser admin = new EverNoteUser() { Name = "Ramazan", ActýveGuýd = Guid.NewGuid(), IsActýve = true, Email = "*****@*****.**", Surname = "Sokuoðlu", IsAdmýn = true, ProfileImageFilename = "boy.png", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******", UserName = "******", Password = "******", }; context.EverNoteUsers.Add(admin); context.SaveChanges(); }
/* Yöntem-2*/ //public EverNoteUser RegisterUser(RegisterViewModel data) //{ // EverNoteUser user = repo_user.Find(x => x.UserName == data.UserName || x.Email == data.Email); // if(user != null) // { // throw new Exception("Kayıtlı kullanıcı ya da e-posta adresi."); // } // return user; //} /* Yöntem-2-Son*/ public BusinessLayerResult <EverNoteUser> RegisterUser(RegisterViewModel data) { EverNoteUser user = repo_user.Find(x => x.UserName == data.UserName || x.Email == data.Email); BusinessLayerResult <EverNoteUser> res = new BusinessLayerResult <EverNoteUser>(); if (user != null) { if (user.UserName == data.UserName) { res.AddError(ErrorMessageCode.UserNameAlreadyExist, "Kullanıcı adı kayıtlı."); } if (user.Email == data.Email) { res.AddError(ErrorMessageCode.UserEmailExist, "E-Posta kayıtlı."); } } else { int dbResult = repo_user.Insert(new EverNoteUser() { UserName = data.UserName, Email = data.Email, Password = data.Password, ActiveGuid = Guid.NewGuid(), IsActive = false, IsAdmin = false, ProfileImageFileName = "userimg.jfif" }); if (dbResult > 0) { res.Result = repo_user.Find(x => x.Email == data.Email && x.UserName == data.UserName); string siteUri = ConfigHelper.Get <string>("SiteRootUri"); string activateUri = $"{siteUri}/Home/UserActivate/{res.Result.ActiveGuid}"; string body = $"Merhaba {res.Result.UserName};\n Hesabınızı aktifleştirmek için <a href='{activateUri}' target='_blank'> tıklayınız.</a>"; MailHelper.SendMail(body, res.Result.Email, "MyEverNote Hesap Aktifleştirme"); } } return(res); }
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; } BusinessLayetResult <EverNoteUser> res = evernoteUserManager.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)); } CurrentSession.Set <EverNoteUser>("login", res.Result); return(RedirectToAction("ShowProfile")); } return(View(model)); }
protected override void Seed(DatabaseContext context) { EverNoteUser admin = new EverNoteUser() { Name = "Fuat", Surname = "Özer", Email = "*****@*****.**", ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = true, Username = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******", ProfileImageFilename = "User_boy.png" }; EverNoteUser standartUser = new EverNoteUser() { Name = "fatih", Surname = "Özer", Email = "*****@*****.**", ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = false, Username = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******", ProfileImageFilename = "User_boy.png" }; context.EvernoteUsers.Add(admin); context.EvernoteUsers.Add(standartUser); for (int i = 0; i < 8; i++) { EverNoteUser user = new EverNoteUser() { Name = FakeData.NameData.GetFirstName(), Surname = FakeData.NameData.GetSurname(), Email = FakeData.NetworkData.GetEmail(), ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = false, Username = $"user{i}", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******", ProfileImageFilename = "User_boy.png" }; context.EvernoteUsers.Add(user); } context.SaveChanges(); List <EverNoteUser> userlist = context.EvernoteUsers.ToList(); for (int i = 0; i < 10; i++) { Category cat = new Category() { Title = FakeData.PlaceData.GetStreetName(), Description = FakeData.PlaceData.GetAddress(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******" }; context.Categories.Add(cat); for (int k = 0; k < FakeData.NumberData.GetNumber(10, 20); k++) { EverNoteUser owner = userlist[FakeData.NumberData.GetNumber(0, userlist.Count - 1)]; Note note = new Note() { Title = FakeData.TextData.GetAlphabetical(FakeData.NumberData.GetNumber(5, 25)), Text = FakeData.TextData.GetSentences(FakeData.NumberData.GetNumber(1, 3)), IsDraft = false, LikeCount = FakeData.NumberData.GetNumber(10, 50), Owner = userlist[FakeData.NumberData.GetNumber(0, userlist.Count - 1)], CreatedOn = FakeData.DateTimeData.GetDatetime(), ModifiedOn = DateTime.Now, ModifiedUsername = owner.Username }; cat.Notes.Add(note); for (int j = 0; j < FakeData.NumberData.GetNumber(3, 6); j++) { EverNoteUser owner_comment = userlist[FakeData.NumberData.GetNumber(0, userlist.Count - 1)]; Comment comment = new Comment() { Text = FakeData.TextData.GetSentence(), Owner = owner_comment, CreatedOn = FakeData.DateTimeData.GetDatetime(), ModifiedOn = DateTime.Now, ModifiedUsername = owner_comment.Username }; note.Comments.Add(comment); } for (int m = 0; m < FakeData.NumberData.GetNumber(1, 3); m++) { Liked liked = new Liked() { LikedUser = userlist[m] }; note.Likes.Add(liked); } } } context.SaveChanges(); }
protected override void Seed(DatabaseContext context) { //admin kullanıcı ekleme işlemi. EverNoteUser admin = new EverNoteUser() { Name = "Aydan", SurName = "Torun", Email = "*****@*****.**", ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = true, UserName = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUserName = "******", ProfilImageFileName = "user.png" }; //standart kullanıcı ekleme. EverNoteUser standartUser = new EverNoteUser() { Name = "Maykıl", SurName = "Ceksın", Email = "ceksı[email protected]", ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = false, UserName = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUserName = "******", ProfilImageFileName = "user.png" }; context.EverNoteUsers.Add(admin); context.EverNoteUsers.Add(standartUser); //fake kullanıcı ekleme. for (int i = 0; i < 8; i++) { EverNoteUser fakeuser = new EverNoteUser() { Name = NameData.GetFirstName(), SurName = NameData.GetSurname(), Email = NetworkData.GetEmail(), ActivateGuid = Guid.NewGuid(), IsActive = true, IsAdmin = false, UserName = $"user{i}", Password = "******", CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = $"user{i}", ProfilImageFileName = "user.png" }; context.EverNoteUsers.Add(fakeuser); } context.SaveChanges(); //User List For using List <EverNoteUser> userList = context.EverNoteUsers.ToList(); //Adding fake Categories for (int i = 0; i < 10; i++) { Category cat = new Category() { Title = PlaceData.GetStreetName(), Description = PlaceData.GetAddress(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUserName = "******" }; context.Categories.Add(cat); //Adding fake Notes for (int k = 0; k < NumberData.GetNumber(5, 9); k++) { EverNoteUser owner = userList[NumberData.GetNumber(0, userList.Count - 1)]; Note note = new Note() { Title = TextData.GetAlphabetical(NumberData.GetNumber(5, 25)), Text = TextData.GetSentences(NumberData.GetNumber(1, 3)), Category = cat, IsDraft = false, LikeCount = NumberData.GetNumber(1, 9), Owner = owner, CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = owner.UserName }; cat.Notes.Add(note); //Adding fake comments for (int j = 0; j < NumberData.GetNumber(3, 5); j++) { EverNoteUser comment_owner = userList[NumberData.GetNumber(0, userList.Count - 1)]; Comment comment = new Comment() { Text = TextData.GetSentence(), Owner = comment_owner, CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = comment_owner.UserName, // Note=note }; note.Comments.Add(comment); //Adding sahte beğeniler for (int m = 0; m < note.LikeCount; m++) { Liked liked = new Liked() { LikedUser = userList[m] }; note.Likes.Add(liked); } } } context.SaveChanges(); } }
protected override void Seed(DataBaseContext context) { //adding admin user EverNoteUser admin = new EverNoteUser() { Name = "hasan", Surname = "gurhan", Email = "*****@*****.**", ActivateGuid = Guid.NewGuid(), IsActivite = true, Username = "******", ProfileImageFilename = "User.png", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******" }; //adding standart user EverNoteUser standartUser = new EverNoteUser() { Name = "ipsadsadek", Surname = "gurhsadasdan", Email = "*****@*****.**", ActivateGuid = Guid.NewGuid(), IsActivite = true, Username = "******", ProfileImageFilename = "User.png", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUsername = "******" }; context.EvernoteUsers.Add(admin); context.EvernoteUsers.Add(standartUser); for (int i = 0; i < 8; i++) { EverNoteUser user = new EverNoteUser() { Name = FakeData.NameData.GetFirstName(), Surname = FakeData.NameData.GetSurname(), Email = FakeData.NetworkData.GetEmail(), ActivateGuid = Guid.NewGuid(), IsActivite = true, Username = $"user{i}", ProfileImageFilename = "User.png", Password = "******", CreatedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedUsername = $"user{i}", }; context.EvernoteUsers.Add(user); } context.SaveChanges(); //userlist for using ... List<EverNoteUser> userlist = context.EvernoteUsers.ToList(); // fake data categories for (int i= 0; i < 10; i++) { Category cat = new Category() { Title = FakeData.PlaceData.GetStreetName(), Description = FakeData.PlaceData.GetAddress(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******" }; context.Categories.Add(cat); //adding fake notes for (int k = 0; k < FakeData.NumberData.GetNumber(5,9); k++) { EverNoteUser owner = userlist[FakeData.NumberData.GetNumber(0, userlist.Count - 1)]; Note note = new Note() { Title = FakeData.TextData.GetAlphabetical(FakeData.NumberData.GetNumber(5, 25)), Text = FakeData.TextData.GetSentences(FakeData.NumberData.GetNumber(1, 3)), Category = cat, IsDraft = false, LikeCount = FakeData.NumberData.GetNumber(1, 9), Owner = owner, CreatedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedUsername = owner.Username, }; cat.Notes.Add(note); //adding fake comments for (int j = 0; j < FakeData.NumberData.GetNumber(3, 5); j++) { EverNoteUser comment_owner = userlist[FakeData.NumberData.GetNumber(0, userlist.Count - 1)]; Comment comment = new Comment() { Text = FakeData.TextData.GetSentence(), Owner = comment_owner, CreatedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedOn = FakeData.DateTimeData.GetDatetime(DateTime.Now.AddYears(-1), DateTime.Now), ModifiedUsername = comment_owner.Username, }; note.Commnets.Add(comment); } //adding fake like for (int m = 0; m < note.LikeCount; m++) { Liked liked = new Liked() { LikedUser = userlist[m] }; note.Likes.Add(liked); } } } context.SaveChanges(); }
protected override void Seed(DatabaseContext context) { EverNoteUser admin = new EverNoteUser() { Name = "Ayan", Surname = "Ünal", Email = "*****@*****.**", ActiveGuid = Guid.NewGuid(), IsActive = true, IsAdmin = true, UserName = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUserName = "******", ProfileImageFileName = "userimg.jfif" }; EverNoteUser standartuser = new EverNoteUser() { Name = "Can", Surname = "Ünal", Email = "*****@*****.**", ActiveGuid = Guid.NewGuid(), IsActive = true, IsAdmin = true, UserName = "******", Password = "******", CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now.AddMinutes(5), ModifiedUserName = "******", ProfileImageFileName = "userimg.jfif" }; context.EverNoteUsers.Add(admin); context.EverNoteUsers.Add(standartuser); //Adding fake user for (int i = 0; i < 8; i++) { EverNoteUser fakeuser = new EverNoteUser() { Name = NameData.GetFirstName(), Surname = NameData.GetSurname(), Email = NetworkData.GetEmail(), ActiveGuid = Guid.NewGuid(), IsActive = true, IsAdmin = false, UserName = $"user{i}", Password = "******", CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = $"user{i}", ProfileImageFileName = "userimg.jfif" }; context.EverNoteUsers.Add(fakeuser); } context.SaveChanges(); //user lidt for using List <EverNoteUser> userlist = context.EverNoteUsers.ToList(); //adding fake categories for (int i = 0; i < 10; i++) { Category cat = new Category() { Title = PlaceData.GetStreetName(), Description = PlaceData.GetAddress(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUserName = "******" }; context.Categories.Add(cat); //adding fake notes for (int k = 0; k < NumberData.GetNumber(5, 9); k++) { EverNoteUser owner = userlist[NumberData.GetNumber(0, userlist.Count - 1)]; Note note = new Note() { Title = TextData.GetAlphabetical(NumberData.GetNumber(5, 25)), Text = TextData.GetSentences(NumberData.GetNumber(1, 3)), Category = cat, IsDraft = false, LikeCount = NumberData.GetNumber(1, 9), Owner = owner, CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = owner.UserName }; cat.Notes.Add(note); //adding fake comment for (int j = 0; j < NumberData.GetNumber(3, 5); j++) { EverNoteUser comment_owner = userlist[NumberData.GetNumber(0, userlist.Count - 1)]; Comment comment = new Comment() { Text = TextData.GetSentence(), Owner = comment_owner, CreatedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedOn = DateTimeData.GetDatetime(DateTime.Now.AddYears(-2), DateTime.Now), ModifiedUserName = comment_owner.UserName //Note=note }; note.Comments.Add(comment); //adding fake likes for (int m = 0; m < note.LikeCount; m++) { Liked liked = new Liked() { LikedUser = userlist[m] }; note.Likes.Add(liked); } } } context.SaveChanges(); } }
public ActionResult EditPRofile(EverNoteUser user) { return(View()); }