Beispiel #1
0
        //[Authorize(Roles = "Admin")]
        public IActionResult UpdateProfile(UpdateProfileModel model)
        {
            IActionResult result = Unauthorized();

            try
            {
                UserItem u = _db.GetUserItemByLogin(model.Username);
                u.Email        = model.Email;
                u.FirstName    = model.FirstName;
                u.LastName     = model.LastName;
                u.PhotoURL     = model.PhotoURL;
                u.WorkoutGoals = model.Goals;
                _db.UpdateUserProfile(u);
                result = Ok();
            }
            catch (Exception)
            {
                result = BadRequest(new { Message = "Role update failed." });
            }
            return(result);
        }