public bool UpdateInactive(int categoryId) { var ActiveCategory = FindCategoryById(categoryId); if (ActiveCategory == null) { return(false); } this.category = new Category() { CategoryID = categoryId, CategoryCode = ActiveCategory.CategoryCode, CategoryName = ActiveCategory.CategoryName, IsActive = ActiveCategory.IsActive ? false : true, SortOrder = ActiveCategory.SortOrder }; if (this._category.Update(this.category, c => c.CategoryID == categoryId).IsNull()) { return(false); } return(true); }
public bool SaveCategory(CategoryDto categoryDetails) { this.category = categoryDetails.DtoToEntity(); if (this._category.Insert(this.category).IsNull()) { return(false); } return(true); }
public static IOBalanceEntity.Category DtoToEntity(this CategoryDto dto) { IOBalanceEntity.Category entity = null; if (!dto.IsNull()) { entity = new IOBalanceEntity.Category { CategoryCode = dto.CategoryCode.Trim(), CategoryName = dto.CategoryName.Trim(), CategoryID = dto.CategoryID, IsActive = true, SortOrder = 0 }; } return(entity); }
public CategoryService(IIOBalanceRepository <Category> category) { this._category = category; this.category = new IOBalanceEntity.Category(); }