public ActionResult Create(FormCollection collection) { string name = Request["name"]; string id = Request["id"]; config_major_kindModel c = new config_major_kindModel() { major_kind_id = id, major_kind_name = name }; int add = bll.Add(c); if (add > 0) { return(JavaScript("alert('新增成功');window.location.href='/config_major_kind/Index'")); } else { return(JavaScript("alert('新增失败');window.location.href='/config_major_kind/Index'")); } try { // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Add(config_major_kindModel c) { // TODO: Add insert logic here if (ind.Add(c) > 0) { return(Content("<script>alert('新增成功');window.location='Index'</script>")); } else { // return Content("<script>alert('新增失败');window.location='Index'</script>"); ViewBag.dt = c; } return(View()); }