public IHttpActionResult All()
        {
            if (TimingDelay.IsTimingDelay())
            {
                throw new Exception(Error.TimeDelation);
            }

            IEnumerable <LocalStorageProductItemField> data = DbS.product_store.Where(
                p => p.active == true && p.trash == false)
                                                              .Select(ps => new LocalStorageProductItemField
            {
                Id            = ps.Id,
                ProductItemId = ps.product_itemId,
                ProductTypeId = ps.product_typeId,
                Cost          = ps.cost,
                CurrencyCode  = ps.currencyCode,
                HotOffer      = ps.hotOffer
            });

            var store = data.ToDictionary(item => item.Id, item => item);


            if (0 < store.Count)
            {
                return(Json(store));
            }

            throw new Exception(Error.NoData);
        }
Exemple #2
0
        //        [HttpGet]
        public object All()
        {
            if (TimingDelay.IsTimingDelay())
            {
                throw new Exception(Error.TimeDelation);
            }

            IEnumerable <TypeProductField> query = DbS.product_type.Select(i => new TypeProductField
            {
                Id         = i.Id,
                NativeName = i.Name,
                Property   =
                    System.Web.Helpers.Json.Decode(i.property)
            });


            var data = query.ToDictionary <TypeProductField, int, TypeProductField>(item => item.Id, item => item);

            if (0 < data.Count)
            {
                return(Json(data));
            }
            throw new Exception(Error.NoData);
        }