public ActionResult SmsinfomsgDelete(int id) { SmsinfomsgModel theMsg = new SmsinfomsgModel(); theMsg = theMsg.FindOne(id); theMsg.Delete(); return(RedirectToAction("Edit")); }
public ActionResult SmsinfomsgEdit(int id) { SmsinfosprModel theSpr = new SmsinfosprModel(); ViewBag.SprList = theSpr.FindAllAsSelectList(); SmsinfomsgModel theMsg = new SmsinfomsgModel(); theMsg = theMsg.FindOne(id); ViewBag.Title = theMsg.Name; return(PartialView("_MsgEdit", theMsg)); }
public ActionResult SmsinfomsgCreate(FormCollection collection) { try { SmsinfomsgModel theMsg = new SmsinfomsgModel(); theMsg.Name = collection["Name"]; theMsg.Text = collection["Text"]; theMsg.NewSprName = collection["NewSprName"]; theMsg.SmsinfosprID = Convert.ToInt32(collection["SmsinfosprID"]); theMsg.Create(); return(RedirectToAction("Edit")); } catch (Exception ex) { System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary(); route.Add("err", ex.Message); return(RedirectToAction("Error", "User", route)); } }