コード例 #1
0
        public List <BaseDto> Create(List <BaseDto> items)
        {
            try
            {
                IList <TEntity> data = _repository.Create(FromDtosToEntityCollection(items));

                return(new List <BaseDto>(_mutator.EntitiesToDtoList <TDto>(data)));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public List <UserDto> GetUserList()
        {
            try
            {
                List <UserDto> users = _mutator.EntitiesToDtoList <UserDto>(_context.UserRepository.GetAll());

                users.ForEach(u =>
                {
                    UserDto connectedUser = _userList.FirstOrDefault(user => user.Id == u.Id);

                    if (connectedUser != null)
                    {
                        u.IsConnected = connectedUser.IsConnected;
                        u.Host        = connectedUser.Host;
                    }
                });

                return(users);
            }
            catch (Exception ex)
            {
                throw new FaultException <Exception>(ex, new FaultReason(ex.Message));
            }
        }