public static Object getAllCategory(Db.Category.CategoryDb.tbCategory y) { try { if (y.tbCategories.Count() != 0) { return(y.tbCategories.Select(x => new { x.Id, x.Name, x.ParentId, x.Description, Childrents = getAllCategory(x) })); } } catch (Exception) { } return(new List <Object>()); }
partial void DeletetbCategory(tbCategory instance);
partial void UpdatetbCategory(tbCategory instance);
partial void InserttbCategory(tbCategory instance);
private void detach_tbCategories(tbCategory entity) { this.SendPropertyChanging(); entity.tbCategory1 = null; }
private void attach_tbCategories(tbCategory entity) { this.SendPropertyChanging(); entity.tbCategory1 = this; }
public static List <Db.Category.CategoryDb.tbCategory> GetChild(CategoryDbDataContext context, Db.Category.CategoryDb.tbCategory category) { var data = new List <Db.Category.CategoryDb.tbCategory>(); foreach (var item in category.tbCategories) { data.Add(item); data.AddRange(GetChild(context, item)); } return(data); }