Example #1
0
 public ActionResult AccountSettings(User user)
 {
     ViewBag.Settings = "Account";
     if (ModelState.IsValidField("Email") && ModelState.IsValidField("Username"))
     {
         Repository.UpdateUserBasic(user);
         ViewBag.Info = "Settings Saved!";
     }
     if(String.Equals(user.Username, User.Identity.Name))
         return View("ProfileSettings", Repository.GetCurrentUser());
     return RedirectToAction("SignOut");
 }
Example #2
0
 public void UpdateUserInfo(User user)
 {
     var us = GetCurrentUser();
     us.FullName = user.FullName;
     us.WebsiteURL = user.WebsiteURL;
     us.Bio = user.Bio;
     us.Location = user.Location;
     datacontext.SaveChanges();
 }
Example #3
0
 public void UpdateUserBasic(User user)
 {
     var us = GetCurrentUser();
     us.Username = user.Username;
     us.Email = user.Email;
     datacontext.SaveChanges();
 }
Example #4
0
 public bool UpdateDesign(User user)
 {
     var us = GetCurrentUser();
     us.BackgroundImage = user.BackgroundImage.Substring(user.BackgroundImage.LastIndexOf('/') + 1);
     us.Tiled = user.Tiled;
     us.LinkColor = user.LinkColor;
     us.BackgroundColor = user.BackgroundColor;
     return datacontext.SaveChanges() > 0;
 }
Example #5
0
 public ActionResult DesignSettings(User user)
 {
     ViewBag.Settings = "Design";
     return View("ProfileSettings", Repository.GetCurrentUser());
 }
Example #6
0
 public ActionResult UpdateDesign(User user)
 {
     ViewBag.Settings = "Design";
     return Json(Repository.UpdateDesign(user) ? "Settings Saved!" : "Error changing settings");
 }
Example #7
0
 public ActionResult ProfileSettings(User user, HttpPostedFileBase Avatar)
 {
     if (Avatar != null && IsImage(Avatar) && Avatar.ContentLength > 0)
         Repository.SaveAvatar(Avatar);
     if (ModelState.IsValidField("FullName") && ModelState.IsValidField("Location") && ModelState.IsValidField("WebsiteURL") && ModelState.IsValidField("Bio"))
         Repository.UpdateUserInfo(user);
     ViewBag.Info = "Settings Saved!";
     ViewBag.Settings = "Profile";
     return View("ProfileSettings", Repository.GetCurrentUser());
 }