public IHttpActionResult Get() { var service = new HumanService(); var human = service.GetHumans(); return(Ok(human)); }
public async Task <StatsViewModel> getStats() { IHumanStats query = new HumanService(_context); var list = await query.GetHumans(); StatsViewModel stats = new StatsViewModel(); stats.count_mutant_dna = list.Where(m => m.mutant).Count(); stats.count_human_dna = list.Where(m => !m.mutant).Count(); stats.ratio = stats.count_human_dna > 0 ? Math.Round(Convert.ToDouble(stats.count_mutant_dna) / Convert.ToDouble(stats.count_human_dna), 2) : 0; return(stats); }