示例#1
0
 public GoodDTO GetGoodById(int id)
 {
     using (var entities = new GoodDAL())
     {
         var good = entities.tblGoods.FirstOrDefault(c => c.id == id);
         return(_mapper.Map <GoodDTO>(good));
     }
 }
示例#2
0
        public List <GoodDTO> GetGoodByCategory(CategoryDTO categoryDTO)
        {
            List <GoodDTO> products = new List <GoodDTO>();

            using (var entities = new GoodDAL())
            {
                products = _mapper.Map <List <GoodDTO> >(entities.tblGoods.Where(c => c.category_id == categoryDTO.id)).ToList();
            }
            return(products);
        }
示例#3
0
        public List <GoodDTO> GetAllProduct()
        {
            List <GoodDTO> products = new List <GoodDTO>();

            using (var entities = new GoodDAL())
            {
                products = _mapper.Map <List <GoodDTO> >(entities.tblGoods).ToList();
            }
            return(products);
        }