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"); }
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(); }
public void UpdateUserBasic(User user) { var us = GetCurrentUser(); us.Username = user.Username; us.Email = user.Email; datacontext.SaveChanges(); }
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; }
public ActionResult DesignSettings(User user) { ViewBag.Settings = "Design"; return View("ProfileSettings", Repository.GetCurrentUser()); }
public ActionResult UpdateDesign(User user) { ViewBag.Settings = "Design"; return Json(Repository.UpdateDesign(user) ? "Settings Saved!" : "Error changing settings"); }
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()); }