public static Category ToDB(this BllCategory entity) { return(new Category { Id = entity.Id, Name = entity.Name, ParentId = entity.ParentId }); }
public static CategoryViewModel ToViewModel(this BllCategory entity) { return(new CategoryViewModel { Id = entity.Id, Name = entity.Name, ParentId = entity.ParentId, ChildCount = entity.PagesCount, HasChilds = entity.HasChildCategory }); }
public void Update(BllCategory entity) { entity.ParentId = entity.ParentId < 2 ? 2 : entity.ParentId; _categoriesRepository.Update(entity.ToDB()); }
public BllCategory Create(BllCategory entity) { entity.ParentId = entity.ParentId < 2 ? 2 : entity.ParentId; return(_categoriesRepository.Create(entity.ToDB())?.ToBll()); }