public Category getCategoryByDescriptionGF(string description) { category x = ctx.categories.FirstOrDefault(o => o.name == description); Category c = new Category(); c.CategoryId = x.categoryId; c.CategoryName = x.name; return c; //gaofan }
public List<Category> getAllCategoryGF() { var item = from o in ctx.categories select o; List<Category> list = new List<Category>(); foreach (var i in item) { Category c = new Category(); c.CategoryId = i.categoryId; c.CategoryName = i.name; list.Add(c); } return list; //gaofan }