示例#1
0
        public IHttpActionResult UpdateProfile([FromBody] ProfileViewModel viewModel)
        {
            UserRepository     db   = new UserRepository();
            UserInfoRepository db2  = new UserInfoRepository();
            User        user        = db.GetUser(viewModel.Id);
            ProfileInfo profileinfo = db2.GetUserProfileInfo(viewModel.Id);

            user.FirstName            = viewModel.FirstName;
            user.LastName             = viewModel.LastName;
            user.BirthDate            = viewModel.BirthDate;
            user.Gender               = viewModel.Gender;
            user.ProfilePictureUrl    = viewModel.ProfilePictureUrl;
            profileinfo.Werk          = viewModel.Work;
            profileinfo.School        = viewModel.School;
            profileinfo.Woonplaats    = viewModel.Hometown;
            profileinfo.RelatieStatus = viewModel.Relation;
            profileinfo.Hobbies       = viewModel.Hobby;

            db.UpdateUser(user);
            db2.UpdateProfileInfo(profileinfo);
            return(Ok());
        }