public bool Add(ProductCategoryModifyModel entity) { using (var repository = _sourceFactory.CreateRepository <ProductCategory, int>()) { return(repository.Add(new ProductCategory { Name = entity.Name, Description = entity.Description })); }; }
public bool Update(int id, ProductCategoryModifyModel entity) { using (var repository = _sourceFactory.CreateRepository<ProductCategory, int>()) { var category = repository.GetSingle(id); if (category == null) throw new NotFoundException(); //Here logic of updateing existed entity category.Name = entity.Name; category.Description = entity.Description; return repository.Update(category); } }