public async Task <PetColorConfig> CreatePetColor(PetColorConfig color, User activeDev) { using (var trans = TransactionScopeFactory.Create()) { color.Id = await ConfigRepo.CreatePetColor(color); trans.Complete(); } color = (await ConfigRepo.RetrieveColorsByIds(color.Id)).FirstOrDefault(); return(color); }
public async Task <int> CreatePetColor(PetColorConfig color) { int output = (await dbConnection.QueryAsync <int>(@"INSERT INTO petColorConfigs(name, imagePath) VALUES(@color, @imagePath) RETURNING id", new { color = color.Name, imagePath = color.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> CreateColor([FromBody] PetColorConfig color, [ModelBinder(typeof(LoggedInUserModelBinder))] User activeDev) { return(Ok(await AdminDomain.CreatePetColor(color, activeDev))); }