Пример #1
0
        public Task <GetAllInvoiceResponse> getAllInvoice(SearchInvoiceRequest request)
        {
            GetAllInvoiceResponse response = new GetAllInvoiceResponse();

            try
            {
                List <InvoiceModel> datas      = new List <InvoiceModel>();
                PagedModel          pagedModel = _service.Search(request.from_time, request.customer_code, request.customer_id, request.page, request.page_size);

                if (pagedModel.Data != null)
                {
                    foreach (InvoiceModel q in pagedModel.Data)
                    {
                        q.Address = _addressService.Get(q.AddressId);
                        q.Items   = _invoiceItemService.GetListItemOfInvoice(q.ID);
                        datas.Add(q);
                    }
                }
                response.Data     = datas;
                response.Page     = pagedModel.Page;
                response.PageSize = pagedModel.PageSize;
                response.Total    = pagedModel.PageTotal;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return(Task.FromResult(response));
        }
Пример #2
0
        public Task <GetAllInvoiceResponse> getInvoice(int invoiceId)
        {
            GetAllInvoiceResponse response = new GetAllInvoiceResponse();

            try
            {
                List <InvoiceModel> datas = new List <InvoiceModel>();
                InvoiceModel        model = _service.Get(invoiceId);

                if (model != null)
                {
                    model.Address = _addressService.Get(model.AddressId);
                    model.Items   = _invoiceItemService.GetListItemOfInvoice(model.ID);
                }
                datas.Add(model);
                response.Data  = datas;
                response.Total = 1;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return(Task.FromResult(response));
        }