예제 #1
0
        public void InsertNinja()
        {
            //inicializa a injeção de dependencia
            //SimpleInjectorContainer.RegisterServices();

            INinjaRepository     ninjaRepository     = new NinjaRepository();
            INinjaClanRepository ninjaClanRepository = new NinjaClanRepository();

            var ninjaClan = ninjaClanRepository.FindBy(nc => nc.ClanName == "Camargo's").FirstOrDefault();

            if (ninjaClan != null)
            {
                Ninja ninja = new Ninja
                {
                    NinjaName    = "Bruna",
                    DateCreated  = DateTime.Now,
                    DateModified = DateTime.Now,
                    NinjaClanId  = ninjaClan.Id
                };

                if (!ninjaRepository.FindBy(n => n.NinjaName == ninja.NinjaName).Any())
                {
                    ninjaRepository.Add(ninja);
                    ninjaRepository.Save();
                }
            }
        }
예제 #2
0
        public void AddNinja()
        {
            var ninja = new NinjaViewModel()
            {
                Gold = Gold,
                Name = Name
            };

            if (!NinjaRepository.Add(ninja))
            {
                return;
            }
            Ninja.UpdateCollection();
            Close();
        }
예제 #3
0
        public void InsertNinjaWithoutClan()
        {
            //inicializa a injeção de dependencia
            SimpleInjectorContainer.RegisterServices();

            INinjaRepository ninjaRepository = new NinjaRepository();

            Ninja ninja = new Ninja
            {
                NinjaName    = "Bolacha",
                DateCreated  = DateTime.Now,
                DateModified = DateTime.Now
            };

            if (!ninjaRepository.FindBy(n => n.NinjaName == ninja.NinjaName).Any())
            {
                ninjaRepository.Add(ninja);
                ninjaRepository.Save();
            }
        }