Exemplo n.º 1
0
 public NpcMonsterSkill(NpcMonsterSkillDTO input)
 {
     NpcMonsterSkillId = input.NpcMonsterSkillId;
     NpcMonsterVNum    = input.NpcMonsterVNum;
     Rate      = input.Rate;
     SkillVNum = input.SkillVNum;
 }
Exemplo n.º 2
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));
     }
 }
 public static bool ToNpcMonsterSkillDTO(NpcMonsterSkill input, NpcMonsterSkillDTO output)
 {
     if (input == null)
     {
         return(false);
     }
     output.NpcMonsterSkillId = input.NpcMonsterSkillId;
     output.NpcMonsterVNum    = input.NpcMonsterVNum;
     output.Rate      = input.Rate;
     output.SkillVNum = input.SkillVNum;
     return(true);
 }
 public IEnumerable <NpcMonsterSkillDTO> LoadByNpcMonster(short npcId)
 {
     using (OpenNosContext context = DataAccessHelper.CreateContext())
     {
         List <NpcMonsterSkillDTO> result = new List <NpcMonsterSkillDTO>();
         foreach (NpcMonsterSkill npcMonsterSkillobject in context.NpcMonsterSkill.AsNoTracking().Where(i => i.NpcMonsterVNum == npcId))
         {
             NpcMonsterSkillDTO dto = new NpcMonsterSkillDTO();
             Mapper.Mappers.NpcMonsterSkillMapper.ToNpcMonsterSkillDTO(npcMonsterSkillobject, dto);
             result.Add(dto);
         }
         return(result);
     }
 }
 public List <NpcMonsterSkillDTO> LoadAll()
 {
     using (OpenNosContext context = DataAccessHelper.CreateContext())
     {
         List <NpcMonsterSkillDTO> result = new List <NpcMonsterSkillDTO>();
         foreach (NpcMonsterSkill npcMonsterSkillobject in context.NpcMonsterSkill.AsNoTracking())
         {
             NpcMonsterSkillDTO dto = new NpcMonsterSkillDTO();
             Mapper.Mappers.NpcMonsterSkillMapper.ToNpcMonsterSkillDTO(npcMonsterSkillobject, dto);
             result.Add(dto);
         }
         return(result);
     }
 }
Exemplo n.º 6
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);
     }
 }
        public NpcMonsterSkillDTO Insert(ref NpcMonsterSkillDTO npcMonsterSkill)
        {
            try
            {
                using (OpenNosContext context = DataAccessHelper.CreateContext())
                {
                    NpcMonsterSkill entity = new NpcMonsterSkill();
                    Mapper.Mappers.NpcMonsterSkillMapper.ToNpcMonsterSkill(npcMonsterSkill, entity);
                    context.NpcMonsterSkill.Add(entity);
                    context.SaveChanges();
                    if (Mapper.Mappers.NpcMonsterSkillMapper.ToNpcMonsterSkillDTO(entity, npcMonsterSkill))
                    {
                        return(npcMonsterSkill);
                    }

                    return(null);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(null);
            }
        }
 public NpcMonsterSkillDTO Insert(ref NpcMonsterSkillDTO npcmonsterskill)
 {
     throw new NotImplementedException();
 }