Пример #1
0
            public Model Handle(Query message)
            {
                var upcomingExhibits = _repository.GetUpcomingExhibits(message.SearchTerm);
                var attendances      = _attendanceRepository.GetAllAttendances();

                var model = new Model
                {
                    UpcomingExhibits = upcomingExhibits.Select(ue => new Model.Exhibit
                    {
                        Id             = ue.Id,
                        PhotographerId = ue.PhotographerId,
                        Location       = ue.Location,
                        ImageUrl       = _urlComposer.ComposeImgUrl(ue.ImageUrl),
                        DateTime       = ue.DateTime,
                        IsCanceled     = ue.IsCanceled,
                        Genre          = new Model.Exhibit.GenreT
                        {
                            Name = ue.Genre.Name
                        }
                    }).ToList(),
                    Attendances = attendances.Select(a => new Model.Attendance
                    {
                        ExhibitId  = a.ExhibitId,
                        AttendeeId = a.AttendeeId
                    }).ToList(),
                    ShowActions = message.ShowActions,
                    UserId      = message.UserId,
                    Heading     = "SEARCH RESULTS"
                };

                return(model);
            }
Пример #2
0
            public Model Handle(Query message)
            {
                var upcomingExhibits = _exhibitRepository.GetUpcomingExhibits(message.SearchTerm);
                var attendances      = _attendanceRepository.GetAllAttendances();

                var model = new Model
                {
                    Attendances = attendances.Select(a => new Model.Attendance
                    {
                        ExhibitId  = a.ExhibitId,
                        AttendeeId = a.AttendeeId
                    }).ToList(),
                    ShowActions    = message.ShowActions,
                    UserId         = message.UserId,
                    PhotographerId = message.PhotographerId,
                    Heading        = "NYC Photography Exhibits"
                };

                int pageSize   = 8;
                int pageNumber = (message.Page ?? 1);

                model.UpcomingExhibits = upcomingExhibits.Select(ue => new Model.Exhibit
                {
                    Id             = ue.Id,
                    PhotographerId = ue.PhotographerId,
                    Location       = ue.Location,
                    ImageUrl       = _urlComposer.ComposeImgUrl(ue.ImageUrl),
                    DateTime       = ue.DateTime,
                    IsCanceled     = ue.IsCanceled,
                    Genre          = new Model.Exhibit.GenreT {
                        Name = ue.Genre.Name
                    },
                    Photographer = new Model.Exhibit.PhotographerT {
                        Name = ue.Photographer.Name
                    }
                }).ToList().ToPagedList(pageNumber, pageSize);    // isToList necessary?

                return(model);
            }
Пример #3
0
 public AttendanceResponse GetAllAttendances(AttendanceSearchRequest attendanceSearchRequest)
 {
     return(attendanceRepository.GetAllAttendances(attendanceSearchRequest));
 }
Пример #4
0
            public Model Handle(Query message)
            {
                var attendances  = _attendanceRepository.GetAllAttendances();
                var photographer = _applicationUserRepository.GetPhotographer(message.PhotographerId);

                var following = _applicationUserRepository.GetPhotographerFollowers(message.PhotographerId);
                var followers = _applicationUserRepository.GetPhotographerFollowing(message.PhotographerId);

                var upcomingExhibits  = _exhibitRepository.GetUpcomingExhibitsByPhotographer(message.PhotographerId);
                var attendingExhibits = _exhibitRepository.GetExhibitsUserAttending(message.PhotographerId);

                var isFollowing = _followingRepository.GetFollowing(message.UserId, message.PhotographerId) != null;

                var model = new Model
                {
                    PhotographerId    = message.PhotographerId,
                    PhotographerName  = photographer.Name,
                    PhotographerEmail = photographer.Email,
                    UserId            = message.UserId,
                    ShowActions       = message.ShowActions,
                    Attendances       = attendances.Select(a => new Model.Attendance
                    {
                        ExhibitId  = a.ExhibitId,
                        AttendeeId = a.AttendeeId
                    }).ToList(),
                    IsFollowing = isFollowing,
                    Heading     = "[Users] Exhibits"
                };

                if (photographer.ImageUrl != null)
                {
                    model.ImageUrl = _urlComposer.ComposeImgUrl(photographer.ImageUrl);
                }

                model.UpcomingExhibits = upcomingExhibits.Select(ue => new Model.Exhibit
                {
                    Id             = ue.Id,
                    PhotographerId = ue.PhotographerId,
                    Location       = ue.Location,
                    ImageUrl       = _urlComposer.ComposeImgUrl(ue.ImageUrl),
                    DateTime       = ue.DateTime,
                    IsCanceled     = ue.IsCanceled,
                    Genre          = new Model.Exhibit.GenreT {
                        Name = ue.Genre.Name
                    },
                    Photographer = new Model.PhotographerT {
                        Name = ue.Photographer.Name
                    }
                }).ToList();

                model.AttendingExhibits = attendingExhibits.Select(ae => new Model.Exhibit
                {
                    Id             = ae.Id,
                    PhotographerId = ae.PhotographerId,
                    Location       = ae.Location,
                    ImageUrl       = _urlComposer.ComposeImgUrl(ae.ImageUrl),
                    DateTime       = ae.DateTime,
                    IsCanceled     = ae.IsCanceled,
                    Genre          = new Model.Exhibit.GenreT {
                        Name = ae.Genre.Name
                    },
                    Photographer = new Model.PhotographerT {
                        Name = ae.Photographer.Name
                    }
                }).ToList();

                model.Followers = followers.Select(f => new Model.PhotographerT
                {
                    Id       = f.Id,
                    Name     = f.Name,
                    ImageUrl = _urlComposer.ComposeImgUrl(f.ImageUrl),
                    Email    = f.Email,
                }).ToList();

                model.Following = following.Select(f => new Model.PhotographerT
                {
                    Id       = f.Id,
                    Name     = f.Name,
                    ImageUrl = _urlComposer.ComposeImgUrl(f.ImageUrl),
                    Email    = f.Email,
                }).ToList();

                return(model);
            }
Пример #5
0
 public List <Attendance> GetAttendanceByUserId(string id)
 {
     return(_attendance.GetAllAttendances().Where(attendance => attendance.UserId == id).ToList());
 }
Пример #6
0
        //Attendance repo

        public IReadOnlyList <Attendance> GetAllAttendances()
        {
            return(_attendance.GetAllAttendances());
        }