//
        // GET: /PricingTier/Create
        public ActionResult Create(string returnUrl, int CompanyID = 0)
        {
            ViewBag.ReturnUrl = returnUrl;
            ViewBag.CompanyID = new SelectList(db.Companies.Where(c => c.CompanyStatus != archived), "CompanyID", "CompanyName");

            // Generate Decoration method for member initialization
            PricingTier pricingTier = new PricingTier();
            pricingTier.OnCreate();

            return View(pricingTier);
        }
        // PricingTier
        public AuditTrail(DateTime dateTime, string userName, PricingTier pricingTier, int id, string comment)
        {
            this.AuditTrailTimeStamp = dateTime;
            this.AuditTrailUserName = userName;
            this.AuditTrailComment = comment;

            if(id > 0)
            {
                this.PricingTierID = id;
            }
            else
            {
                this.PricingTier = pricingTier;
            }
        }
        public ActionResult Create(PricingTier pricingtier, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                // Add Audit Entry
                AuditTrail audit = new AuditTrail(DateTime.Now, User.Identity.Name, pricingtier, pricingtier.PricingTierID, "Create");
                db.AuditTrails.Add(audit);

                db.PricingTiers.Add(pricingtier);
                db.SaveChanges();

                if(returnUrl == null)
                {
                    return RedirectToAction("Index");
                }
                return Redirect(returnUrl);
            }

            ViewBag.CompanyID = new SelectList(db.Companies.Where(c => c.CompanyStatus != archived), "CompanyID", "CompanyName", pricingtier.CompanyID);
            return View(pricingtier);
        }