Exemple #1
0
        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);
        }
Exemple #2
0
        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;
 }
Exemple #4
0
 public async Task <ActionResult> CreateColor([FromBody] PetColorConfig color, [ModelBinder(typeof(LoggedInUserModelBinder))] User activeDev)
 {
     return(Ok(await AdminDomain.CreatePetColor(color, activeDev)));
 }