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); }
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); }
public PetDetails(Pet pet, PetSpeciesConfig species, PetColorConfig color) { this.Pet = pet; this.Species = species; this.Color = color; }
public async Task <ActionResult> CreateSpecies([FromBody] PetSpeciesConfig species, [ModelBinder(typeof(LoggedInUserModelBinder))] User activeDev) { return(Ok(await AdminDomain.CreatePetSpecies(species, activeDev))); }