public override Task <GetAllConferencesResponse> GetAll( GetAllConferencesRequest request, ServerCallContext context) { var result = new GetAllConferencesResponse(); result.Conferences.Add(repo.GetAll()); return(Task.FromResult(result)); }
public IActionResult GetAll() { var conferences = repo.GetAll(); if (!conferences.Any()) return new NoContentResult(); return new ObjectResult(conferences); }
public StatisticModel GetStatistics() { var conferences = conferenceRepo.GetAll(); return(new StatisticModel { AverageConferenceAttendees = (int)conferences.Average(x => x.AtendeeTotal), NumberOfAttendees = conferences.Sum(x => x.AtendeeTotal) }); }
public async Task <StatisticsModel> GetStatistics() { var conferences = await _conferenceRepo.GetAll(); return(new StatisticsModel { NumberOfAttendees = conferences.Sum(c => c.AttendeeTotal), AverageConferenceAttendees = (int)conferences.Average(c => c.AttendeeTotal) }); }
public async Task <IActionResult> GetAll() { var conferences = await _repo.GetAll(); if (!conferences.Any()) { return(new NoContentResult()); } return(new ObjectResult(conferences)); }