예제 #1
0
        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);
        }
예제 #2
0
        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);
        }