private object BuildReferenceDto(Category item)
 {
     return new{
         StringId = _stringConverter.ToString(item),
         Description = item.ToString(),
     };
 }
        public IPresentableSet<Product> SearchNormal(int? productId, string productName, bool? discontinued, Category category, Supplier supplier)
        {
            IQueryable<Product> queryable = _northwind.GetCurrentSession().Linq<Product>();
            if(productId != default(int?))
            {
                queryable = queryable.Where(x => x.ProductId == productId);
            }
            if(!string.IsNullOrEmpty(productName))
            {
                queryable = queryable.Where(x => x.ProductName.StartsWith(productName));
            }
            if(discontinued != default(bool?))
            {
                queryable = queryable.Where(x => x.Discontinued == discontinued);
            }
            if(category != default(Category))
            {
                queryable = queryable.Where(x => x.Category == category);
            }
            if(supplier != default(Supplier))
            {
                queryable = queryable.Where(x => x.Supplier == supplier);
            }

            return new QueryablePresentableSet<Product>(queryable);
        }
Example #3
0
 public virtual bool Equals(Category other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     if (CategoryId != default(int))
     {
         return other.CategoryId == CategoryId;
     }
     return other.CategoryId == CategoryId && other.CategoryName == CategoryName && other.Description == Description && other.Picture == Picture && 1 == 1;
 }
        private object BuildFullDto(Category item)
        {
            return new{
                StringId = _stringConverter.ToString(item),
                item.CategoryId,
                item.CategoryName,
                item.Description,
                // item.Picture, // Skip bacause is binary data

                // item.Products, // Skip bacause is collection of non detail objects
            };
        }
        public IQueryable<Product> SearchNormal(int? productId, string productName, string quantityPerUnit, decimal? unitPrice, short? unitsInStock, short? unitsOnOrder, short? reorderLevel, bool? discontinued, Category category, Supplier supplier)
        {
            IQueryable<Product> queryable = _Northwind.Linq<Product>();
            if (productId != default(int?))
            {
                queryable = queryable.Where(x => x.ProductId == productId);
            }
            if (productName != default(string))
            {
                queryable = queryable.Where(x => x.ProductName == productName);
            }
            if (quantityPerUnit != default(string))
            {
                queryable = queryable.Where(x => x.QuantityPerUnit == quantityPerUnit);
            }
            if (unitPrice != default(decimal?))
            {
                queryable = queryable.Where(x => x.UnitPrice == unitPrice);
            }
            if (unitsInStock != default(short?))
            {
                queryable = queryable.Where(x => x.UnitsInStock == unitsInStock);
            }
            if (unitsOnOrder != default(short?))
            {
                queryable = queryable.Where(x => x.UnitsOnOrder == unitsOnOrder);
            }
            if (reorderLevel != default(short?))
            {
                queryable = queryable.Where(x => x.ReorderLevel == reorderLevel);
            }
            if (discontinued != default(bool?))
            {
                queryable = queryable.Where(x => x.Discontinued == discontinued);
            }
            if (category != default(Category))
            {
                queryable = queryable.Where(x => x.Category == category);
            }
            if (supplier != default(Supplier))
            {
                queryable = queryable.Where(x => x.Supplier == supplier);
            }

            return queryable;
        }
 public string ToString(Category obj)
 {
     return obj.CategoryId.ToString();
 }
 public void Update(Category v)
 {
     _northwind.GetCurrentSession().Update(v);
 }
 public void Delete(Category v)
 {
     _northwind.GetCurrentSession().Delete(v);
 }
 public void Create(Category v)
 {
     _northwind.GetCurrentSession().Save(v);
 }
 public void Update(Category v)
 {
     _Northwind.Update(v);
 }
 public void Delete(Category v)
 {
     _Northwind.Delete(v);
 }
 public void Create(Category v)
 {
     _Northwind.Save(v);
 }