예제 #1
0
        public ActionResult EditAbout()
        {
            ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());

            AboutViewModel viewModel = new AboutViewModel()
            {
                FirstName      = user.Fname,
                LastName       = user.Lname,
                Address        = user.Address,
                FacebookUrl    = user.FacebookUrl,
                Gender         = user.Gender,
                LinkedUrl      = user.LinkinUrl,
                MilitaryStatus = user.MilitaryStatus,
                Summary        = user.Summary,
                TwitterUrl     = user.TwitterUrl
            };

            return(PartialView(viewModel));
        }
예제 #2
0
        public ActionResult EditAbout(AboutViewModel model)
        {
            ApplicationDbContext db      = new ApplicationDbContext();
            string          userId       = User.Identity.GetUserId();
            ApplicationUser _currentUser = db.Users.Where(a => a.Id == userId).FirstOrDefault();

            _currentUser.Fname          = model.FirstName;
            _currentUser.Lname          = model.LastName;
            _currentUser.Gender         = model.Gender;
            _currentUser.MilitaryStatus = model.MilitaryStatus;
            _currentUser.MaritaSutes    = model.MaritaSutes;
            _currentUser.Address        = model.Address;
            _currentUser.Summary        = model.Summary;
            _currentUser.FacebookUrl    = model.FacebookUrl;
            _currentUser.LinkinUrl      = model.LinkedUrl;
            _currentUser.TwitterUrl     = model.TwitterUrl;

            db.SaveChanges();
            return(PartialView("StaticAbout", _currentUser));
        }