Exemple #1
0
    public ActionResult List()
    {
        var model = new AttendeeListPageModel();

        var attendees = CurrentAttendee.List();
        var waitList  = CurrentAttendee.WaitList();

        model.Attendees = attendees;
        model.WaitList  = waitList;

        model.AttendeeCount = attendees.Count();

        return(View(model));
    }
        public ActionResult Attendees()
        {
            var attendeeList = CurrentAttendee.List();
            var serializer   = new CSVSerializer();

            var builder = new StringBuilder();

            builder.AppendLine(serializer.Header(new CurrentAttendee()));
            attendeeList.ForEach(x => builder.AppendLine(serializer.Serialize(x)));

            var result = new FileContentResult(Encoding.ASCII.GetBytes(builder.ToString()), "text/csv")
            {
                FileDownloadName = "Attendees.csv"
            };

            return(new EmptyResult());
        }