Example #1
0
        public async Task <PetSpeciesConfig> CreatePetSpecies(PetSpeciesConfig species, User activeDev)
        {
            using (var trans = TransactionScopeFactory.Create())
            {
                species.Id = await ConfigRepo.CreatePetSpecies(species);

                trans.Complete();
            }
            species = (await ConfigRepo.RetrieveSpeciesByIds(species.Id)).FirstOrDefault();
            return(species);
        }
Example #2
0
        public async Task <int> CreatePetSpecies(PetSpeciesConfig species)
        {
            int output = (await dbConnection.QueryAsync <int>(@"INSERT INTO petSpeciesConfigs(name, baseHealthPoints, foodBasis, description, imagePath) 
                VALUES(@speciesName, @maxHP, @food, @desc, @image) RETURNING id",
                                                              new
            {
                speciesName = species.Name,
                maxHP = species.BaseHealthPoints,
                food = species.FoodBasis,
                desc = species.Description,
                image = species.ImagePath
            })).First();

            return(output);
        }
Example #3
0
 public PetDetails(Pet pet, PetSpeciesConfig species, PetColorConfig color)
 {
     this.Pet     = pet;
     this.Species = species;
     this.Color   = color;
 }
Example #4
0
 public async Task <ActionResult> CreateSpecies([FromBody] PetSpeciesConfig species, [ModelBinder(typeof(LoggedInUserModelBinder))] User activeDev)
 {
     return(Ok(await AdminDomain.CreatePetSpecies(species, activeDev)));
 }