public Account( string firstname, string lastname, MailAddress email, Password password, AccountRole role, ConfirmationStatus confirmationStatus, DateTime registrationTime, Profile profile, int redmineUserId, int gitlabUserId) { Require.NotEmpty(firstname, nameof(firstname)); Require.NotEmpty(lastname, nameof(lastname)); Require.NotNull(email, nameof(email)); Require.NotNull(password, nameof(password)); Require.ZeroOrGreater(redmineUserId, nameof(redmineUserId)); Require.ZeroOrGreater(gitlabUserId, nameof(gitlabUserId)); Require.NotNull(email, nameof(email)); Require.NotNull(password, nameof(password)); Firstname = firstname; Lastname = lastname; Email = email; Password = password; Role = role; ConfirmationStatus = confirmationStatus; RegistrationTime = registrationTime; Profile = profile; RedmineUserId = redmineUserId; GitlabUserId = gitlabUserId; }
public CreateAccountRequest( MailAddress email, string lastname, string firstname, string password, Profile profile) { Require.NotNull(email, nameof(email)); Require.NotEmpty(lastname, nameof(lastname)); Require.NotEmpty(firstname, nameof(firstname)); Require.NotEmpty(password, nameof(password)); Email = email.Address; Lastname = lastname; Firstname = firstname; Password = password; Profile = profile; }
public IHttpActionResult UpdateProfile(int id, [FromBody] ProfileUpdateRequest profileRequest) { Require.Positive(id, nameof(id)); Require.NotNull(profileRequest, nameof(profileRequest)); User.AssertResourceOwnerOrAdmin(id); if (!ModelState.IsValid) { return BadRequest(ModelState); } Account userToChange; try { userToChange = _userManager.GetUser(id); } catch (AccountNotFoundException) { return NotFound(); } if (profileRequest != null) { var profile = new Profile { Image = profileRequest.Image, InstituteName = profileRequest.InstituteName, PhoneNumber = profileRequest.PhoneNumber, Specialization = profileRequest.Specialization, StudentAccessionYear = profileRequest.StudentAccessionYear, StudyingDirection = profileRequest.StudyingDirection, VkProfileUri = profileRequest.VkProfileUri }; userToChange.Profile = profile; } _userManager.UpdateUser(userToChange); return Ok(); }