Exemplo n.º 1
0
        public async Task <Guid> CreateMonster(MonsterDto monster, int exp = 1)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                var attr = GenerateAttributesAccordingToExperience(exp);
                attr.Id = Guid.NewGuid();

                monster.Attributes = attr;
                monster.Id         = _monsterService.Create(monster);
                await uow.Commit();

                return(monster.Id);
            }
        }
Exemplo n.º 2
0
 // GET api/values
 public async System.Threading.Tasks.Task<bool> UpdateAtlanticaMonster()
 {
     
     try
     { 
         List<Monster> monsters = await MonsterCrawler.ReadMonsters();
         IList<Monster> currentmonsters = _monsterService.GetAll();
         for (int i = 0; i < monsters.Count; i++)
         {
             Monster auxmonster = monsters[i];
             if(currentmonsters.Count(c=>c.Id == auxmonster.Id) <= 0)
                 _monsterService.Create(auxmonster);
         }
     }
     catch (Exception ex)
     {
         return false;
     }
     return true;
 }
        public JsonResult AddMonster([FromBody] Monster monster)
        {
            var model = _monsterService.Create(monster);

            return(Result(HttpStatusCode.OK, model));
        }