Example #1
0
 public NpcMonsterSkillDTO Insert(ref NpcMonsterSkillDTO npcMonsterskill)
 {
     using (var context = DataAccessHelper.CreateContext())
     {
         NpcMonsterSkill entity = _mapper.Map <NpcMonsterSkill>(npcMonsterskill);
         context.NpcMonsterSkill.Add(entity);
         context.SaveChanges();
         return(_mapper.Map <NpcMonsterSkillDTO>(entity));
     }
 }
Example #2
0
 public void Insert(List <NpcMonsterSkillDTO> skills)
 {
     using (var context = DataAccessHelper.CreateContext())
     {
         context.Configuration.AutoDetectChangesEnabled = false;
         foreach (NpcMonsterSkillDTO Skill in skills)
         {
             NpcMonsterSkill entity = _mapper.Map <NpcMonsterSkill>(Skill);
             context.NpcMonsterSkill.Add(entity);
         }
         context.Configuration.AutoDetectChangesEnabled = true;
         context.SaveChanges();
     }
 }
Example #3
0
 public NpcMonsterSkillDTO Insert(ref NpcMonsterSkillDTO npcMonsterskill)
 {
     try
     {
         using (var context = DataAccessHelper.CreateContext())
         {
             NpcMonsterSkill entity = _mapper.Map <NpcMonsterSkill>(npcMonsterskill);
             context.NpcMonsterSkill.Add(entity);
             context.SaveChanges();
             return(_mapper.Map <NpcMonsterSkillDTO>(entity));
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(null);
     }
 }