示例#1
0
 public void Insert(ProdCategoryView model)
 {
     using (var rep = new ProdCategoryRepository())
        {
        rep.Insert(ConvertToProduct(model));
        }
 }
示例#2
0
 public void Delete(int model)
 {
     using (var rep = new ProdCategoryRepository())
        {
        var dev = rep.GetById(model);
        rep.Delete(dev);
        }
 }
示例#3
0
        public List<ProdCategoryView> ViewAll()
        {
            using (var rep = new ProdCategoryRepository())
               {
               return rep.GetAll().Select(x => new ProdCategoryView
               {
                   CategoryId = x.CategoryId,
                   CategoryName = x.CategoryName,

               }).ToList();
               }
        }
示例#4
0
        public void Update(ProdCategoryView modelView)
        {
            using (var rep = new ProdCategoryRepository())
               {
               var dev = rep.GetById(modelView.CategoryId);

               if (dev != null)
               {

                   dev.CategoryName = modelView.CategoryName;

                   rep.Update(dev);
               }
               }
        }