public static IntegrationInfoUser CreateIntegrationInfoUserFromUserEntity(this UserEntity userEntity) { var returnIntegrationInfoUser = new IntegrationInfoUser(); returnIntegrationInfoUser.MapUserEntityToIntegrationInfoUser(userEntity); return(returnIntegrationInfoUser); }
public static void MapUserEntityToIntegrationInfoUser(this IntegrationInfoUser integrationInfoUser, UserEntity userEntity) { integrationInfoUser.MapUserEntityToBaseUser(userEntity); List <ChatIntegration> integrations = userEntity.ChatIntegrations?.Select(x => x.MapDerivedChatIntegration()).ToList(); integrationInfoUser.IntegrationsDetails = integrations; }
public static UserEntity CreateUserEntityFromIntegrationInfoUser(this IntegrationInfoUser baseUser) { UserEntity returnUserEntity = new UserEntity(); returnUserEntity.MapIntegrationInfoUserToUserEntity(baseUser); return(returnUserEntity); }
public ActionResult <IntegrationInfoUser> GetWithIntegrationDetails([FromQuery] Guid userId) { if (userId.Equals(Guid.Empty)) { return(BadRequest()); } var userEntity = _userService.GetUser(userId); if (userEntity == null) { return(StatusCode(404)); } IntegrationInfoUser returnUser = userEntity.CreateIntegrationInfoUserFromUserEntity(); return(returnUser); }
public ActionResult <IntegrationInfoUser> AddUser([FromBody] IntegrationInfoUser baseUser) { if (baseUser == null) { return(BadRequest()); } var entryEntity = baseUser.CreateUserEntityFromIntegrationInfoUser(); var addedUser = _userService.AddUser(entryEntity); if (addedUser == null) { return(StatusCode(500)); } var returnUser = addedUser.CreateIntegrationInfoUserFromUserEntity(); return(returnUser); }
public static void MapIntegrationInfoUserToUserEntity(this UserEntity userEntity, IntegrationInfoUser baseUser) { userEntity.MapBaseUserToUserEntity(baseUser); userEntity.ChatIntegrations = baseUser.IntegrationsDetails?.Select(x => x.MapDerivedIntegrationEntity()).ToList(); }