Пример #1
0
        public IActionResult Index()
        {
            InvoiceRepo allInvoiceRepo = new InvoiceRepo(_context);
            var         invoices       = allInvoiceRepo.All();

            return(View(invoices));
        }
        public ActionResult Index()
        {
            var             repository = new InvoiceRepo(context);
            IList <Invoice> invoices   = repository.GetInvoices();

            return(View("Index", invoices));
        }
 public AddProductToOrder()
 {
     productRepo      = new ProductRepo();
     customerInvoice  = new InvoiceRepo();
     invoiceOrderLine = new OrderLineRepo();
     products         = new List <Product>();
 }
 public CompleteOrder()
 {
     customerRepo      = new CustomerRepo();
     paymentRepo       = new PaymentRepo();
     addProductToOrder = new AddProductToOrder();
     getCustomerList   = new GetCustomerList();
     invoiceRepo       = new InvoiceRepo();
 }
Пример #5
0
 public frmInvoice()
 {
     _errorLogs   = new ErrorLogs();
     _repoProduct = new ProductRepo();
     _repoInvoice = new InvoiceRepo();
     _repoStock   = new StockRepo();
     _vmInvoice   = new InvoiceViewModel();
     InitializeComponent();
 }
Пример #6
0
        public IActionResult GetUniqueInvoiceCountries()
        {
            var repo      = new InvoiceRepo();
            var countries = repo.UniqueInvoiceCountries();

            if (!countries.Any())
            {
                return(NotFound());
            }
            return(Ok(countries));
        }
Пример #7
0
        public IActionResult GetCountryInvoices(string country)
        {
            var repo     = new InvoiceRepo();
            var invoices = repo.GetInvoiceByCountry(country);

            if (!invoices.Any())
            {
                return(NotFound());
            }
            return(Ok(invoices));
        }
Пример #8
0
        public IActionResult Delete(int id)
        {
            InvoiceRepo deleteInvoiceRepo = new InvoiceRepo(_context);

            var success = deleteInvoiceRepo.Delete(id);

            if (success)
            {
                return(RedirectToAction(nameof(Index)));
            }

            ViewBag.Error = "An error occurred while deleting this invoice. Please try again.";
            return(View());
        }
Пример #9
0
 public IActionResult Create(Invoice inVM)
 {
     if (ModelState.IsValid)
     {
         InvoiceRepo inVMRepo = new InvoiceRepo(_context);
         var         success  = inVMRepo.Create(inVM);
         if (success)
         {
             return(RedirectToAction(nameof(Index)));
         }
     }
     ViewBag.Error = "An error occurred while creating this invoice. Please try again.";
     return(View());
 }
        public ActionResult Create(CreateInvoice formModel)
        {
            InvoiceRepo repo = new InvoiceRepo(context);

            try
            {
                var invoice = new Invoice(formModel.InvoiceNumber, formModel.Status, formModel.ClientId);
                invoice.Status = InvoiceStatus.Open;
                repo.Insert(invoice);
                return(RedirectToAction("Index"));
            }
            catch (DbUpdateException ex)
            {
                HandleDbUpdateException(ex);
            }

            formModel.PopulateSelectLists(context);
            return(View("Create", formModel));
        }
Пример #11
0
        public IActionResult Create(string username)
        {
            ViewBag.SelectedUser = username;

            InvoiceRepo invoRepo = new InvoiceRepo(_context);

            var users = invoRepo.GetAllUsers().ToList();

            var preUsersList = users.Select(us =>
                                            new SelectListItem {
                Value = us.UserName, Text = us.UserName
            }).ToList();

            var userList = new SelectList(preUsersList, "Value", "Text");


            ViewBag.UserSelectList = userList;

            return(View());
        }
 private void frmCompleteDetailsPurchased_Load(object sender, EventArgs e)
 {
     _ObjInvoice   = new InvoiceRepo();
     invoiceNumber = CustomerInvoice.invoiceNo;
     loadData();
 }
Пример #13
0
 public InvoiceManager()
 {
     repo = new InvoiceRepo();
 }
Пример #14
0
 private void CustomerInvoice_Load(object sender, EventArgs e)
 {
     _ObjInvoice        = new InvoiceRepo();
     selectedCustomerId = frmCustomerReport.selectedCustomerId;
     loadData();
 }