//
        // GET: /VendorType/Create
        public ActionResult Create()
        {
            // Generate Decoration method for member initialization
            VendorType vendorType = new VendorType();
            vendorType.OnCreate();

            return View(vendorType);
        }
        public ActionResult Create(VendorType vendortype)
        {
            if(ModelState.IsValid)
            {
                // Add Audit Entry
                AuditTrail audit = new AuditTrail(DateTime.Now, User.Identity.Name, vendortype, vendortype.VendorTypeID, "Create");
                db.AuditTrails.Add(audit);

                db.VendorTypes.Add(vendortype);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

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

            if (id > 0)
            {
                this.VendorTypeID = id;
            }
            else
            {
                this.VendorType = vendorType;
            }
        }