示例#1
0
        public static IntegrationInfoUser CreateIntegrationInfoUserFromUserEntity(this UserEntity userEntity)
        {
            var returnIntegrationInfoUser = new IntegrationInfoUser();

            returnIntegrationInfoUser.MapUserEntityToIntegrationInfoUser(userEntity);
            return(returnIntegrationInfoUser);
        }
示例#2
0
        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;
        }
示例#3
0
        public static UserEntity CreateUserEntityFromIntegrationInfoUser(this IntegrationInfoUser baseUser)
        {
            UserEntity returnUserEntity = new UserEntity();

            returnUserEntity.MapIntegrationInfoUserToUserEntity(baseUser);
            return(returnUserEntity);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 public static void MapIntegrationInfoUserToUserEntity(this UserEntity userEntity, IntegrationInfoUser baseUser)
 {
     userEntity.MapBaseUserToUserEntity(baseUser);
     userEntity.ChatIntegrations = baseUser.IntegrationsDetails?.Select(x => x.MapDerivedIntegrationEntity()).ToList();
 }