Exemplo n.º 1
0
        public ActionResult List()
        {
            //Return info about user
            ViewBagApplicationUser();

            if (ApplicationUser() == "")
            {
                return(RedirectToAction("NotFound", "Invoice"));
            }

            //////////////////////////
            //Get Bill
            bill.Bill();
            //Sum of all articles without Tax
            ViewBag.sumOfAllWithoutTax = bill.ViewBagsumOfAllWithoutTax(ApplicationUserID());
            //Sum of all articles on bill with Tax
            ViewBag.sumOfAllWithTax = bill.ViewBagsumOfAllWithTax(GetDecimalTax(), ApplicationUserID());
            //Sum of all articles on bill with Tax

            var catalog = new AggregateCatalog();

            // Adds all the parts found in the same assembly as the Program class.
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(ITax).Assembly));

            // Create the CompositionContainer with the parts in the catalog.
            _container = new CompositionContainer(catalog);

            // Fill the imports of this object.
            try
            {
                this._container.ComposeParts(this);
            }
            catch (CompositionException compositionException)
            {
                Console.WriteLine(compositionException.ToString());
            }

            //Import with MEF
            ViewBag.taxSum = taxSum.sumAllPDV(GetDecimalTax(), ApplicationUserID());

            //////////////////////////

            return(View(bill.Bill()));
        }