public List <SanPham> DSSanPham() { using (var db = new ShopBanHangDbContext()) { List <SanPham> dsSP = db.SanPhams.ToList(); return(dsSP); } }
public JsonResult DataTableGet([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { var context = new ShopBanHangDbContext(); var model = new CodeProduct(); IQueryable <ProductModel> query = model.GetAllProduct().AsQueryable(); var totalCount = query.Count(); // Apply filters if (!string.IsNullOrEmpty(requestModel.Search.Value)) { var value = requestModel.Search.Value.Trim(); query = query.Where(p => p.Name.Contains(value)); } var filteredCount = query.Count(); // Sort var sortedColumns = requestModel.Columns.GetSortedColumns(); var orderByString = String.Empty; foreach (var column in sortedColumns) { orderByString += orderByString != String.Empty ? "," : ""; orderByString += (column.Data) + (column.SortDirection == Column.OrderDirection.Ascendant ? " asc" : " desc"); } orderByString = orderByString == String.Empty ? "ID asc" : orderByString; query = query.OrderBy(orderByString); // Paging query = query.Skip(requestModel.Start).Take(requestModel.Length); var data = query.Select(p => new { Id = p.ID, Name = p.Name, Price = p.Price, Quantity = p.Quantity, Category = p.Category, CreatedDate = p.CreatedDate.ToString("dd-MM-yyyy"), Action = "<br /><p class=\"btn-action\"><a href=\"#\" class=\"detail\"><i class=\"ui-tooltip fa fa-pencil-square-o detail\" style=\"font-size: 22px;\" data-original-title=\"Detail\"></i></a> <a href=\"#\" class=\"remove\" ><i class=\"ui-tooltip fa fa-trash-o remove\" style=\"font-size: 20px;\" data-original-title=\"Delete\" tooltip=\"Delete\"></i></a></p>", }).ToList(); return(Json(new DataTablesResponse(requestModel.Draw, data, filteredCount, totalCount), JsonRequestBehavior.AllowGet)); }
public CodeCategory() { db = new ShopBanHangDbContext(); }
public GroupPermissionDao() { db = new ShopBanHangDbContext(); }
public CodeContact() { context = new ShopBanHangDbContext(); }
public CodeUser() { db = new ShopBanHangDbContext(); }
public CodeShop() { db = new ShopBanHangDbContext(); }
public List <Product> GetFeatureProduct() { ShopBanHangDbContext db = new ShopBanHangDbContext(); return(db.Products.Where(x => x.TopHot != null).OrderBy(x => x.ID).Take(2).ToList()); }
public CodeAbout() { db = new ShopBanHangDbContext(); }
public CodeMenu() { db = new ShopBanHangDbContext(); }
public CodeFooter() { context = new ShopBanHangDbContext(); }
public CodeMenuType() { context = new ShopBanHangDbContext(); }
public CodeBeacon() { context = new ShopBanHangDbContext(); }
public CodeProduct() { db = new ShopBanHangDbContext(); }
public CodeOrderDetail() { db = new ShopBanHangDbContext(); }
public UserPermissionDao() { db = new ShopBanHangDbContext(); }
public CodeLogin() { db = new ShopBanHangDbContext(); }
public CodeType() { db = new ShopBanHangDbContext(); }