public ActionResult Post([FromBody] EditProfileData profileData)
 {
     //middleware uses something with (watch chapter 47) and look into nameidentifier, this
     //also this only works because the first one is the tokenidentifer. This should be changed accordingly
     //get the userid
     var user = GetSecureUser();
     context.SaveChanges();
     return Ok(user);
 }
示例#2
0
        public ActionResult Post([FromBody] EditProfileData profileData)
        {
            var user = GetSecureUser();

            user.FirstName = profileData.FirstName ?? user.FirstName;
            user.LastName  = profileData.LastName ?? user.LastName;

            context.SaveChanges();
            return(Ok(user));
        }
示例#3
0
        public ActionResult Post([FromBody] EditProfileData editProfileData)
        {
            try
            {
                var user = GetSecureUser();
                user.FirstName = editProfileData.FirstName ?? user.FirstName;
                user.LastName  = editProfileData.LastName ?? user.LastName;

                _context.SaveChanges();

                return(Ok(user));
            }
            catch (Exception e)
            {
                return(BadRequest("Unable to save user data. " + e.Message));
            }
        }