public void Insert(ProdCategoryView model) { using (var rep = new ProdCategoryRepository()) { rep.Insert(ConvertToProduct(model)); } }
public void Delete(int model) { using (var rep = new ProdCategoryRepository()) { var dev = rep.GetById(model); rep.Delete(dev); } }
public List<ProdCategoryView> ViewAll() { using (var rep = new ProdCategoryRepository()) { return rep.GetAll().Select(x => new ProdCategoryView { CategoryId = x.CategoryId, CategoryName = x.CategoryName, }).ToList(); } }
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); } } }