public ActionResult Create(Application application) { if (ModelState.IsValid) { application.LastAction = "Application Created"; application.LastRemoteUser = User.Identity.Name; application.LastRemoteAddr = Request.UserHostAddress; application.LastModified = DateTime.Now; application.Groups = new List<Group> { new Group { ShortName = "Regular Users", LongName = "Regular Users", Advertise = true, Privileged = false, Pseudo = true, Sensitivity = InformationSensitivity.Unknown, LastAction = "Group Created", LastRemoteUser = User.Identity.Name, LastRemoteAddr = Request.UserHostAddress, LastModified = DateTime.Now } }; db.Applications.Add(application); db.SaveChanges(); return RedirectToAction("Index"); } return View(application); }
public ActionResult Edit(Application application) { if (ModelState.IsValid) { application.LastAction = "Application Modified"; application.LastRemoteUser = User.Identity.Name; application.LastRemoteAddr = Request.UserHostAddress; application.LastModified = DateTime.Now; db.Entry(application).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(application); }