public IEnumerable <AttendanceFormViewModelDto> GetMyAttendances() { var userCurrent = User.Identity.GetUserId(); var gigs = _gigRepository.GetAllFolloweds(_followUpRepository .GetAllWithFollowerFollowed(userCurrent)).Select(Mapper.Map <Gig, GigDto>); var listAttendances = new List <AttendanceFormViewModelDto>(); if (gigs.Count() != 0) { var attendances = _attendanceRepository.GetAllWithArtistGig(userCurrent) .Select(Mapper.Map <Attendance, AttendanceDto>); foreach (var gig in gigs) { var attendancesForm = new AttendanceFormViewModelDto() { Gig = gig, Attendance = false }; foreach (var attendance in attendances) { if (gig.Id == attendance.Gig.Id) { attendancesForm.Id = attendance.Id; attendancesForm.Attendance = true; } } listAttendances.Add(attendancesForm); } } return(listAttendances); }
public IEnumerable <FollowUpFormViewModelDto> GetUsers() { var artists = _userRepository.GetAllWithOutUserCurrent(User.Identity.GetUserId()) .Select(Mapper.Map <ApplicationUser, ApplicationUserDto>); var listFollowed = new List <FollowUpFormViewModelDto>(); if (artists != null) { var followUps = _followUpRepository.GetAllWithFollowerFollowed(User.Identity.GetUserId()) .Select(Mapper.Map <FollowUp, FollowUpDto>); foreach (var artist in artists) { var followUpForm = new FollowUpFormViewModelDto() { Artist = artist, TotalGigs = _gigRepository.GetMyGigs(artist.Id).Count(), UpcomingGigs = _gigRepository.GetMyUpcomingGigs(artist.Id, DateTime.Today).Count(), Follow = false }; foreach (var followUp in followUps) { if (followUp.Followed.Id == artist.Id) { followUpForm.Id = followUp.Id; followUpForm.Follow = true; } } listFollowed.Add(followUpForm); } } return(listFollowed); }