예제 #1
0
        public ActionResult Profile(AccountProfileInputModel input)
        {
            if (ModelState.IsValid)
            {
                var result = this.accountAdapter.UpdateProfile(
                    User.Identity.Name,
                    input.FirstName,
                    input.LastName,
                    input.Email
                );

                if (result.StatusCode == 200)
                {
                    return View(new AccountProfileModel
                    {
                        Input = input,
                        Message = "Profile information updated successfully"
                    }
                    );
                }

                var error = result.Errors.First();
                ModelState.AddModelError(error.MemberNames.First(), error.ErrorMessage);
            }

            return View(new AccountProfileModel { Input = input });
        }
예제 #2
0
        public ActionResult Profile()
        {
            var user = this.accountAdapter.GetUser(User.Identity.Name);

            if (user.StatusCode != 200)
                return this.NotFoundException();

            AccountProfileInputModel input = new AccountProfileInputModel
            {
                FirstName = user.Result.FirstName,
                LastName = user.Result.LastName,
                Email = user.Result.Email
            };

            return View(new AccountProfileModel() { Input = input });
        }