public ActionResult AccountSettings(AccountSettingsModel model, HttpPostedFileBase picture) { if (ModelState.IsValid) { try { byte[] image = null; if (picture != null && picture.ContentLength > 0) { image = new byte[picture.ContentLength]; picture.InputStream.Read(image, 0, image.Length); } var result = Repository.UpdateAccountSettings( Security.CurrentUserId, model.Name, model.Website, model.Location, model.Bio, image); if (result) TempData["Notification"] = Strings.MsgAccountSettingsUpdated; return RedirectToAction("Index", "Account"); } catch { ModelState.AddModelError("", Strings.ErrorAccountSettingsUpdate); } } return View(model); }
public ActionResult AccountSettings() { var model = new AccountSettingsModel(); var user = Repository.FindUser(Security.CurrentUserId); if (user != null) { model.Account = user.Account; model.Name = user.Name; model.Website = user.Website; model.Location = user.Location; model.Bio = user.Bio; } return View(model); }