Ejemplo n.º 1
0
 public ShopSkillDTO Insert(ShopSkillDTO shopSkill)
 {
     using (var context = DataAccessHelper.CreateContext())
     {
         ShopSkill entity = _mapper.Map <ShopSkill>(shopSkill);
         context.ShopSkill.Add(entity);
         context.SaveChanges();
         return(_mapper.Map <ShopSkillDTO>(entity));
     }
 }
Ejemplo n.º 2
0
 public static bool ToShopSkillDTO(ShopSkill input, ShopSkillDTO output)
 {
     if (input == null)
     {
         return(false);
     }
     output.ShopId      = input.ShopId;
     output.ShopSkillId = input.ShopSkillId;
     output.SkillVNum   = input.SkillVNum;
     output.Slot        = input.Slot;
     output.Type        = input.Type;
     return(true);
 }
Ejemplo n.º 3
0
 public IEnumerable <ShopSkillDTO> LoadByShopId(int shopId)
 {
     using (OpenNosContext context = DataAccessHelper.CreateContext())
     {
         List <ShopSkillDTO> result = new List <ShopSkillDTO>();
         foreach (ShopSkill ShopSkill in context.ShopSkill.Where(s => s.ShopId.Equals(shopId)))
         {
             ShopSkillDTO dto = new ShopSkillDTO();
             Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkillDTO(ShopSkill, dto);
             result.Add(dto);
         }
         return(result);
     }
 }
Ejemplo n.º 4
0
 public IEnumerable <ShopSkillDTO> LoadAll()
 {
     using (OpenNosContext context = DataAccessHelper.CreateContext())
     {
         List <ShopSkillDTO> result = new List <ShopSkillDTO>();
         foreach (ShopSkill entity in context.ShopSkill)
         {
             ShopSkillDTO dto = new ShopSkillDTO();
             Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkillDTO(entity, dto);
             result.Add(dto);
         }
         return(result);
     }
 }
Ejemplo n.º 5
0
 public ShopSkillDTO Insert(ShopSkillDTO shopSkill)
 {
     try
     {
         using (var context = DataAccessHelper.CreateContext())
         {
             ShopSkill entity = _mapper.Map <ShopSkill>(shopSkill);
             context.ShopSkill.Add(entity);
             context.SaveChanges();
             return(_mapper.Map <ShopSkillDTO>(entity));
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(null);
     }
 }
Ejemplo n.º 6
0
        public ShopSkillDTO Insert(ShopSkillDTO shopSkill)
        {
            try
            {
                using (OpenNosContext context = DataAccessHelper.CreateContext())
                {
                    ShopSkill entity = new ShopSkill();
                    Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkill(shopSkill, entity);
                    context.ShopSkill.Add(entity);
                    context.SaveChanges();
                    if (Mapper.Mapper.Instance.ShopSkillMapper.ToShopSkillDTO(entity, shopSkill))
                    {
                        return(shopSkill);
                    }

                    return(null);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(null);
            }
        }
Ejemplo n.º 7
0
 public ShopSkillDTO Insert(ShopSkillDTO shopskill)
 {
     throw new NotImplementedException();
 }