public async Task <IActionResult> UpdateUserInfo(UpdateUserModel userModel) { //get the current user object var user = await _userManager.GetUserAsync(HttpContext.User); //update user values user.FirstName = userModel.FirstName; user.LastName = userModel.LastName; user.Bio = userModel.Bio; user = _usersRepo.UpdateUser(user); _usersRepo.SaveChanges(); return(Ok(user)); }
public async Task <IActionResult> CreateProject([FromBody] UtilityProjectModel projectModel) { //get the current user var user = await _userManager.GetUserAsync(HttpContext.User); //convert from a UtilityProjectModel to a projectModel object var project = new Project(); project.Name = projectModel.name; project.Description = projectModel.description; //create a new project for the user project = _usersRepo.CreateUserProject(project, user); _usersRepo.SaveChanges(); return(Ok(project)); }