From 40c424f787351b5e2e89aabedb5e67bfeece7008 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 17 May 2017 20:01:25 -0400 Subject: even more profile fields --- Project-Unite/Controllers/ManageController.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'Project-Unite/Controllers') diff --git a/Project-Unite/Controllers/ManageController.cs b/Project-Unite/Controllers/ManageController.cs index 99f41c9..731c37f 100644 --- a/Project-Unite/Controllers/ManageController.cs +++ b/Project-Unite/Controllers/ManageController.cs @@ -141,6 +141,33 @@ namespace Project_Unite.Controllers return View(usr); } + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult Index(ApplicationUser model) + { + if (!ModelState.IsValid) + return View(model); + var db = new ApplicationDbContext(); + var usr = db.Users.FirstOrDefault(x => x.UserName == User.Identity.Name); + usr.DisplayName = model.DisplayName; + usr.FullName = model.FullName; + usr.Hobbies = model.Hobbies; + usr.Bio = model.Bio; + usr.Interests = model.Interests; + usr.ShowFollowers = model.ShowFollowers; + usr.ShowFollowed = model.ShowFollowed; + usr.ShowEmail = model.ShowEmail; + usr.ShowPostAndTopicCounts = model.ShowPostAndTopicCounts; + usr.ShowJoinDate = model.ShowJoinDate; + if (usr.Email != model.Email) + usr.EmailConfirmed = false; + usr.Email = model.Email; + usr.Website = model.Website; + usr.YoutubeUrl = model.YoutubeUrl; + db.SaveChanges(); + return View(model); + } + // // POST: /Manage/RemoveLogin [HttpPost] -- cgit v1.2.3