public async Task <IActionResult> Create(int?id)
        {
            if (id == null || id < 0)
            {
                head = new InvoiceHeader();
                head.InvoiceDetails = new List <InvoiceDetail>();
                head.InvoiceDetails.AddRange(new InvoiceDetail[3]);
            }
            else
            {
                head = repository.GetById((int)id);
            }
            companyId = await services.GetCurrentCompanyId();

            ViewBag.Customers = new SelectList(customerRepository.GetAll(companyId), "CustomerId", "Name");
            ViewBag.Products  = new SelectList(productRepository.GetAll(companyId), "ProductId", "Name");

            return(View(head));
        }
Esempio n. 2
0
        public async Task <IActionResult> List()
        {
            int companyId = await services.GetCurrentCompanyId();

            return(View(repository.GetAll(companyId)));
        }