public ActionResult Options(string printServer) { MyPrintServer myPrintServers = new MyPrintServer { Name = printServer }; return(View(myPrintServers)); }
public ActionResult Options([Bind(Include = "Name")] MyPrintServer myPrintServer) { if (ModelState.IsValid) { if (FlushDNSCache(myPrintServer.Name.ToString()) == true) { Support.SendEmail("DNS flushed from Print Server.", "DNS has been flushed on the following computer: " + myPrintServer.Name + " by user: "******"SuccessMessage"] = "Congrats, DNS has been flushed from " + myPrintServer.Name + "! Enjoy your day."; return(RedirectToAction("Success")); } else { Support.SendEmail("Failed to flush DNS", "DNS has failed to flush on the following computer: " + myPrintServer.Name + " by user: "******"RedirectToError"] = "Could not flush DNS on " + myPrintServer.Name + ". Please try again or logon to the server directly to clear it."; return(RedirectToAction("Error")); } } TempData["RedirectToError"] = "Something went wrong with the Model. Please try again."; return(RedirectToAction("Error")); }