Example #1
0
        private bool InRole(RoleType role, long userId)
        {
            switch (role)
            {
            case RoleType.Manager:
                return(_managers.GetAll().Any(x => x.UserId == userId));

            case RoleType.Admin:
                return(_admins.GetAll().Any(x => x.UserId == userId));

            case RoleType.Sender:
                return(_senders.GetByUserId(userId) != null);

            case RoleType.Broker:
                return(_brokers.GetByUserId(userId) != null);

            case RoleType.Forwarder:
                return(_forwarders.GetByUserId(userId) != null);

            case RoleType.Carrier:
                return(_carriers.GetByUserId(userId) != null);

            case RoleType.Client:
                return(_clients.GetByUserId(userId) != null);

            default:
                throw new ArgumentOutOfRangeException("role");
            }
        }
Example #2
0
        public virtual JsonResult List(int take, int skip)
        {
            var brokerId = _brokers.GetByUserId(_identity.Id).With(x => (int?)x.Id);

            var senderUserId = _senders.GetByUserId(_identity.Id).With(x => _identity.Id, (long?)null);

            var list = _awbPresenter.List(take, skip, brokerId, senderUserId, _identity.Language);

            return(Json(list));
        }