public void ShouldGetAllConferences() { var conferences = _repository.GetAll().ToArray(); conferences.Length.ShouldBe(3); conferences[0].Id.ShouldBe(Guid.Parse("0E3E638E-DA0B-47DF-B2FC-07F6CC7618DE")); conferences[1].Id.ShouldBe(Guid.Parse("C2AD9DAC-B936-442E-B46D-A73C0B69C147")); conferences[2].Id.ShouldBe(Guid.Parse("F41C8CFC-A6E3-4309-8023-D1425D294468")); }
public IList <ConferenceViewModel> Get() { return(_conferenceRepository.GetAll().Select(x => new ConferenceViewModel { Email = x.Email, AuthorLastName = x.AuthorLastName, AuthorFirstName = x.AuthorFirstName, ArticleAbstract = x.ArticleAbstract, ArticleTitle = x.ArticleTitle }).ToList()); }
//[HttpGet("{id}", Name = "GetById")] //public async Task<ConferenceModel> GetById(int id) //{ // return await conferenceRepository.GetById(id); //} public IActionResult GetAll() { var conferences = conferenceRepository.GetAll().Result; if (!conferences.Any()) { return(new NoContentResult()); } return(new ObjectResult(conferences)); }
private ConferenceXmlModel[] BuildModel() { return(_repository.GetAll() .Select(e => new ConferenceXmlModel { EventName = e.Name, AttendeeCount = e.GetAttendees().Count().ToString(), SessionCount = e.GetSessions().Count().ToString() }) .ToArray()); }
public async Task <StatisticsModel> GetStatistics() { return(await Task.Run(async() => { var conferences = await _conferenceRepo.GetAll().ConfigureAwait(false); return new StatisticsModel { NumberOfAttendees = conferences.Sum(c => c.AttendeeTotal), AverageConferenceAttendees = (int)conferences.Average(c => c.AttendeeTotal) }; }).ConfigureAwait(false)); }
Task <StatisticsModel> IStatisticsRepository.GetStatistics() { var conferences = ConferenceRepository.GetAll().Result; return(Task.Run(() => new StatisticsModel { NumberOfAttendees = conferences.Sum(c => c.AttendeeTotal), AverageConferenceAttendees = (int)conferences.Average(c => c.AttendeeTotal) } )); }
public XmlResult <ConferenceXmlModel[]> Index() { var list = _repository.GetAll() .Select(e => new ConferenceXmlModel { EventName = e.Name, AttendeeCount = e.AttendeeCount.ToString(), SessionCount = e.SessionCount.ToString() }) .ToArray(); return(Xml(list)); }
public async Task <IEnumerable <ConferenceModel> > GetAll() { try { var all = await repo.GetAll(); return(all); } catch (System.Exception ex) { //throw; } return(null); }
public async Task <IEnumerable <ConferenceModel> > GetAll() { return(await repo.GetAll()); }
public async Task <IActionResult> Index() { ViewBag.Title = "Organizer - Conference Overview"; return(View(await _conferenceRepository.GetAll())); }
public IEnumerable <ConferenceViewModel> GetAll() { var conferences = _conferenceRepository.GetAll(); return(_mapper.Map <IEnumerable <ConferenceViewModel> >(conferences)); }
public IEnumerable <Conference> Get() { return(conferenceRepository.GetAll()); }
public ActionResult Index() { var conferences = _repository.GetAll().ToList(); return(View(conferences)); }
public IEnumerable <ConferenceDto> GetAll() { return(_mapper.Map <IEnumerable <ConferenceDto> >(_conferenceRepository.GetAll())); }
public async Task <IEnumerable <ConferenceModel> > GetAll() { return(await _conferenceRepository.GetAll()); }