Exemplo n.º 1
0
        public ActionResult LoadAllInvoiceItems()
        {
            string draw   = Request.Form["draw"].FirstOrDefault();
            string start  = Request.Form["start"].FirstOrDefault();
            string length = Request.Form["length"].FirstOrDefault();

            int take = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsCount = 0;

            var invoiceItems = _invoiceItemsService.GetAllInvoiceItemsDT(take, skip, out recordsCount);

            var toSerialize = new
            {
                draw            = draw,
                recordsFiltered = recordsCount,
                recordsTotal    = recordsCount,

                data = invoiceItems.Select(r => new
                {
                    ID       = r.Id,
                    ItemName = _itemService.GetItemName((int)r.ItemId),
                    Unit     = _unitService.GetUnitName((int)r.UnitId),
                    Price    = r.Price,
                    ItemQty  = r.ItemsQty,
                    Total    = r.Total,
                    Discount = r.Discount,
                    Net      = r.NetPrice
                }).AsQueryable()
            };

            return(Json(toSerialize));
        }