CS0116A namespace cannot directly contain members such as fields or methods
using LifeNstyle.Access;
using System;
using System.Linq;
using System.Web.ModelBinding;
namespace LifeNstyle
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
public IQueryable<Product> GetProducts([QueryString("id")] int? categoryId)
{
var _db = new LifeNstyle.Access.ProductContext();
IQueryable<Product> query = _db.Products;
if (categoryId.HasValue && categoryId > 0)
{
query = query.Where(p => p.CategoryID == categoryId);
}
return query;
}
}