public async Task <ActionResult <Models.Population> > Get(int id)
        {
            var population = dataStore.Get(id);

            if (population == null)
            {
                return(new ObjectResult(population));
            }
            var strata = stratums.GetStratasOf(id).OrderBy(item => item.Class.Id);

            population.Nobility    = strata.ElementAt(0) ?? population.Nobility;
            population.Merchantes  = strata.ElementAt(1) ?? population.Merchantes;
            population.ArtistCraft = strata.ElementAt(2) ?? population.ArtistCraft;
            population.Clir        = strata.ElementAt(3) ?? population.Clir;
            population.Freeman     = strata.ElementAt(4) ?? population.Freeman;
            population.Serfs       = strata.ElementAt(5) ?? population.Serfs;
            population.Slaves      = strata.ElementAt(6) ?? population.Slaves;
            population             = dataStore.Update(id, population);

            return(new ObjectResult(population));
        }
Пример #2
0
 public async Task <ActionResult <IEnumerable <Models.Stratum> > > GetOf(int idPopulation)
 {
     return(new ObjectResult(dataset.GetStratasOf(idPopulation)));
 }