コード例 #1
0
        private void BindBag(long?awbId)
        {
            ViewBag.AwbId = awbId;

            ViewBag.Brokers = _brokers.GetAll().ToDictionary(x => (long?)x.Id, x => x.Name);
            ViewBag.Senders = _senders.GetAll().ToDictionary(x => (long?)x.UserId, x => x.Name);
        }
コード例 #2
0
        public UserListItem[] List(RoleType role)
        {
            switch (role)
            {
            case RoleType.Manager:
                return(_managers.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.EntityId,
                    UserId = x.UserId
                }).ToArray());

            case RoleType.Admin:
                return(_admins.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.EntityId,
                    UserId = x.UserId
                }).ToArray());

            case RoleType.Broker:
                return(_brokers.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.Id,
                    UserId = x.UserId
                }).ToArray());

            case RoleType.Forwarder:
                return(_forwarders.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.Id,
                    UserId = x.UserId
                }).ToArray());

            case RoleType.Carrier:
                return(_carriers.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.Id,
                    UserId = x.UserId
                }).ToArray());

            case RoleType.Sender:
                return(_senders.GetAll().Select(
                           x => new UserListItem
                {
                    Name = x.Name,
                    EntityId = x.EntityId,
                    UserId = x.UserId
                }).ToArray());

            default:
                throw new ArgumentOutOfRangeException("role");
            }
        }
コード例 #3
0
        public async Task GetAll_ShouldNotReturnNull()
        {
            var result = await _brokerRepositoryMock.GetAll();

            Assert.IsNotNull(result);
        }
コード例 #4
0
 public IEnumerable <BrokerViewModel> GetAll()
 {
     return(_brokerRepository.GetAll().ProjectTo <BrokerViewModel>(_mapper.ConfigurationProvider));
 }
コード例 #5
0
        /// <summary>
        /// Get all the properties
        /// </summary>
        /// <returns>Task that returns a list of BrokerDTO</returns>
        public async Task <List <BrokerDTO> > GetAll()
        {
            var propertiesList = await _repository.GetAll();

            return(Mapper.Map <List <Broker>, List <BrokerDTO> >(propertiesList));
        }
コード例 #6
0
 public async Task <ActionResult <List <BrokerViewModel> > > Get()
 {
     return(_mapper.Map <List <BrokerViewModel> >(await _brokerRepository.GetAll()));
 }