public ActionResult CreateProduct() { ViewBag.Start = DateTime.Now; ViewBag.Start = String.Format("{0:dd/MM/yyyy}", ViewBag.Start); ViewBag.Cate = new SelectList(CDal.GetCategories(), "CId", "CName"); return(View()); }
public ActionResult Index() { ViewBag.CCount = CDal.GetCategories().Count(); ViewBag.PCount = PDal.GetProducts().Count(); ViewBag.UCount = UDal.GetUsers().Count(); var Cates = CDal.GetCategories(); var Pros = PDal.GetProducts(); var Users = UDal.GetUsers(); var List = from C in Cates join P in Pros on C.CId equals P.CId join U in Users on P.UId equals U.UId select new { U.UName, P.PName, C.CName, P.MinimumPrice, P.DateStart, P.DateEnd, P.PId }; var PList = (object)JsonConvert.SerializeObject(List); return(View(PList)); }
private void LoadCategories() { var categoryList = _categoryDal.GetCategories(); var newCategoryList = _categoryDal.LatestCategories(3); rptCategories.DataSource = categoryList; rptCategories.DataBind(); rptNewCategories.DataSource = newCategoryList; rptNewCategories.DataBind(); }
private void LoadCategories() { var categoryList = _categoryDal.GetCategories(); rptCategory.DataSource = categoryList; rptCategory.DataBind(); var brandList = _brandDal.GetBrandsName(); rptBrand.DataSource = brandList; rptBrand.DataBind(); }
private void LoadCategories() { var categoryList = _categoryDal.GetCategories(); categorySelect.DataSource = categoryList; categorySelect.DataTextField = "CategoryName"; categorySelect.DataValueField = "CategoryID"; categorySelect.DataBind(); categorySelect.Items.Insert(0, "Select Category"); categoryRepeater.DataSource = categoryList; categoryRepeater.DataBind(); }
public List <Category> GetCategories() { var categoryDal = new CategoryDal(); var dt = categoryDal.GetCategories(); var categoriesList = new List <Category>(); foreach (DataRow dr in dt.Rows) { var category = new Category() { Id = int.Parse(dr["Id"].ToString()), Name = dr["Name"].ToString(), }; categoriesList.Add(category); } return(categoriesList); }