示例#1
0
        public async Task <List <tblInvoice> > GetInvoices()
        {
            List <tblInvoice> uList = new List <tblInvoice>();

            uList = await invoiceRepository.GetAll();

            return(uList);
        }
        public List <InvoiceDTO> GetAllInvoices()
        {
            List <InvoiceDTO> invoiceDTOs = new List <InvoiceDTO>();
            List <Invoice>    invoices    = _invoiceRepository.GetAll();
            int counter = 0;

            foreach (var item in invoices)
            {
                invoiceDTOs.Add(_mapper.Mapper().Map <InvoiceDTO>(item));
                invoiceDTOs[counter].CustomerDTO = _mapper.Mapper().Map <CustomerDTO>(_customerRepository.GetById(invoiceDTOs[counter].CustomerDTOId));
                counter++;
            }
            return(invoiceDTOs);
        }
        public List <InvoiceModel> GetInvoiceList(int companyId, int leadId)
        {
            List <InvoiceModel> invoiceModelList = new List <InvoiceModel>();
            List <Invoice>      invoiceList      = invoiceRepository.GetAll(x => x.CompanyId == companyId && x.RecordDeleted == false && x.LeadId == leadId).ToList();

            AutoMapper.Mapper.Map(invoiceList, invoiceModelList);
            return(invoiceModelList);
        }
        public void InvoiceGetAll()
        {
            // Act
            var invoices = _repo.GetAll();

            // Assert
            Assert.Single(invoices);
        }
示例#5
0
        public IHttpActionResult Get()
        {
            List <Invoice> invoice = inRepo.GetAll();

            if (invoice == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Ok(invoice));
        }
示例#6
0
        public void Invoice_Repository_GetAll_Sucessfully()
        {
            //Arrange and action
            var invoices = _invoiceRepository.GetAll().ToList();
            int quantityAddedsInvoices = 1;

            //Assert
            invoices.Should().NotBeNull();
            invoices.Should().HaveCount(quantityAddedsInvoices);
            invoices.First().Id.Should().Be(_invoiceBase.Id);
        }
        public void DotMemoryUnitTest()
        {
            var repo = new InvoiceRepository();

            repo.GetAll();

            dotMemory.Check(memory =>
                            Assert.Equal(1, memory.GetObjects(where => where.Type.Is <Invoice>()).ObjectsCount));

            GC.KeepAlive(repo); // prevent objects from GC if this is implied by test logic
        }
示例#8
0
 // GET: Invoicing/Invoices
 public ActionResult Index()
 {
     try
     {
         var list = repository.GetAll();
         return(View(list));
     }
     catch
     {
         return(View());
     }
 }
示例#9
0
        public List <Invoice> LoadInvoiceDataBase()
        {
            var invoiceList = new InvoiceRepository();

            return(invoiceList.GetAll().ToList());

            //List<Invoice> invoicesList = new List<Invoice>();
            //var dbContext = Invoices;
            //var invoicesStore = dbContext.Invoices;
            //foreach (var invoice in invoicesStore)
            //{
            //    invoicesList.Add(invoice);
            //}
            //return invoicesList;
        }
示例#10
0
        void CargarFacturas()
        {
            List <Invoice> facturas = new List <Invoice>();

            facturas = repository.GetAll();

            foreach (var factura in facturas)
            {
                factura.ammount     = factura.InvoiceDetails.Select(x => x.subtotal).Sum();
                factura.nroproducts = factura.InvoiceDetails.Select(x => x.quantity).Sum();
            }

            gvFacturas.DataSource = facturas;
            gvFacturas.DataBind();

            gvDetalle.DataSource = null;
            gvDetalle.DataBind();
        }
示例#11
0
        public IHttpActionResult GetByDate(string DocDate)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotAcceptable);

            try
            {
                InvoiceRepository repository = new InvoiceRepository();
                response         = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(repository.GetAll(DocDate)));
            }
            catch (Exception ex)
            {
                Error error = new Error
                {
                    Mensaje        = ex.Message,
                    MensajeInterno = ex.InnerException != null ? ex.InnerException.Message : null
                };

                response         = Request.CreateResponse(HttpStatusCode.InternalServerError);
                response.Content = new StringContent(JsonConvert.SerializeObject(error));
            }
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            return(ResponseMessage(response));
        }
 public IHttpActionResult Get()
 {
     return(Ok(InvoiceRepo.GetAll()));
 }
示例#13
0
        public IActionResult GetAllInvoices()
        {
            var allInvoices = _repo.GetAll();

            return(Ok(allInvoices));
        }
示例#14
0
 public List <Invoice> GetAll()
 {
     return(_repository.GetAll());
 }
 public IEnumerable <Invoice> GetAll()
 {
     return(_repository.GetAll());
 }
示例#16
0
 public ActionResult GetTable(InvoiceType type)
 {
     return(PartialView("_TablePartialView", _repository.GetAll().Where(i => i.InvoiceType == type && i.State == State.Posted)));
 }
 public void GetAll_should_return_a_value()
 {
     Assert.NotNull(testSubject.GetAll());
 }