// // GET: /DecorationMethod/Create public ActionResult Create() { // Generate Decoration method for member initialization DecorationMethod decorationMethod = new DecorationMethod(); decorationMethod.OnCreate(); return View(decorationMethod); }
// Decoration Method public AuditTrail(DateTime dateTime, string userName, DecorationMethod decorationmethod, int id, string comment) { this.AuditTrailTimeStamp = dateTime; this.AuditTrailUserName = userName; this.AuditTrailComment = comment; if(id > 0) { this.DecorationMethodID = id; } else { this.DecorationMethod = decorationmethod; } }
public ActionResult Create(DecorationMethod decorationmethod) { if(ModelState.IsValid) { // Add Audit Entry AuditTrail audit = new AuditTrail(DateTime.Now, User.Identity.Name, decorationmethod, decorationmethod.DecorationMethodID, "Create"); db.AuditTrails.Add(audit); db.DecorationMethods.Add(decorationmethod); db.SaveChanges(); return RedirectToAction("Index"); } return View(decorationmethod); }
public ActionResult Edit(DecorationMethod decorationmethod) { if(ModelState.IsValid) { // Add Audit Entry AuditTrail audit = new AuditTrail(DateTime.Now, User.Identity.Name, decorationmethod, decorationmethod.DecorationMethodID, "Edit"); db.AuditTrails.Add(audit); var current = db.DecorationMethods.Find(decorationmethod.DecorationMethodID); db.Entry(current).CurrentValues.SetValues(decorationmethod); db.SaveChanges(); return RedirectToAction("Index"); } return View(decorationmethod); }