Ejemplo n.º 1
0
        public MonsterViewModel AddMonster(MonsterViewModel monster)
        {
            var monsterToAdd = MonsterMapper.MapModelToEntity(monster);

            monsterToAdd.CreatedBy = "Test";
            monsterToAdd.SeedData  = false;
            var addedMonster = _monsterRepository.Add(monsterToAdd);

            return(MonsterMapper.MapEntityToModel(addedMonster));
        }
Ejemplo n.º 2
0
        public MonsterViewModel UpdateMonster(int id, MonsterViewModel monster)
        {
            var originalMonster = _monsterRepository.GetById(id);

            MonsterMapper.MapModelToEntity(monster, originalMonster);
            originalMonster.ModifiedBy = "UpdateMonster";
            var updatedMonster = _monsterRepository.Update(originalMonster);

            return(MonsterMapper.MapEntityToModel(updatedMonster));
        }
Ejemplo n.º 3
0
 public MonsterViewModel GetMonsterById(int id)
 {
     return(MonsterMapper.MapEntityToModel(_monsterRepository.GetById(id)));
 }