public byte[] GenerateRetreatsReportCsv() { var retreats = _retreatRepository.GetList(); var sb = new StringBuilder(); foreach (var retreat in retreats) { AddRetreatLines(sb, retreat); } return(Encoding.ASCII.GetBytes(sb.ToString())); }
public ActionResult ReassignParticipant(int participantId) { var participant = _participantRepository.GetById(participantId); var viewModel = new ReassignParticipantViewModel { ParticipantName = participant.LastName + ", " + participant.FirstName, ParticipantPhysicalStatus = participant.PhysicalStatus, ParticipantNote = participant.Notes, AvailableRetreats = _retreatRepository.GetList().Where(retreat => !retreat.IsFull).ToArray(), }; return(View(viewModel)); }
IEnumerable <RetreatListRetreatViewModel> GetRetreats() { return(_retreatRepository.GetList().OrderBy(x => x.StartDate).Select( x => new RetreatListRetreatViewModel { Id = x.Id, Description = x.Description, Date = x.StartDate, AddParticipantLink = AddParticipantLinkForRetreat(x), RegisteredParticipants = x.Registrations.Select( y => new RetreatListParticipantViewModel { Id = y.Participant.Id, FirstName = y.Participant.FirstName, LastName = y.Participant.LastName, BedCode = y.Bed == null ? null :y.Bed.Code, DateReceived = y.Participant.DateReceived, PhysicalStatus = y.Participant.PhysicalStatus, Notes = y.Participant.Notes, DeleteLink = BuildDeleteLink(x, y.Participant) }) })); }