예제 #1
0
        /// <summary>
        /// Creates and returns a collection of request view model items.
        /// </summary>
        /// <returns>A collection of request view models.</returns>
        protected override IEnumerable <RequestViewModel> GetItems()
        {
            var role    = ClientSecurityContext.CurrentUser.getRole();
            var viewAll = role.canApproveRequests() || role.canCheckInVehicles() || role.canManageUsers();

            return(from request in AppServices.Get <Request>()
                   where viewAll || request.getRequestor().getId() == ClientSecurityContext.CurrentUser.getId()
                   select new RequestViewModel(request));
        }
        /// <summary>
        /// Creates and returns a collection of user view model items.
        /// </summary>
        /// <returns>A collection of user view models.</returns>
        protected override IEnumerable <UserViewModel> GetItems()
        {
            var role    = ClientSecurityContext.CurrentUser.getRole();
            var viewAll = role.canManageUsers();

            return(from user in AppServices.Get <UserAccount>()
                   where viewAll || user.getId() == ClientSecurityContext.CurrentUser.getId()
                   select new UserViewModel(user));
        }
예제 #3
0
 /// <summary>
 /// Creates and returns a collection of trip view model items.
 /// </summary>
 /// <returns>A collection of trip view models.</returns>
 protected override IEnumerable <TripViewModel> GetItems() =>
 from trip in AppServices.Get <Trip>() select new TripViewModel(trip);
예제 #4
0
 /// <summary>
 /// Creates and returns a collection of vehicle view model items.
 /// </summary>
 /// <returns>A collection of vehicle view models.</returns>
 protected override IEnumerable <VehicleViewModel> GetItems() =>
 from vehicle in AppServices.Get <OwnedVehicle>() select new VehicleViewModel(vehicle);