//
        // GET: /AttachmentType/Create
        public ActionResult Create()
        {
            // Generate Attachment Type method for member initialization
            AttachmentType AttachmentType = new AttachmentType();
            AttachmentType.OnCreate();

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

                db.AttachmentTypes.Add(AttachmentType);
                db.SaveChanges();
                return RedirectToAction("Index");

            }

            return View(AttachmentType);
        }
Ejemplo n.º 3
0
        // AttachmentType
        public AuditTrail(DateTime dateTime, string userName, AttachmentType AttachmentType, int id, string comment)
        {
            this.AuditTrailTimeStamp = dateTime;
            this.AuditTrailUserName = userName;
            this.AuditTrailComment = comment;

            if (id > 0)
            {
                this.AttachmentTypeID = id;
            }
            else
            {
                this.AttachmentType = AttachmentType;
            }
        }