public JsonResult Create(FormCollection form) { ResultBase_form result = new ResultBase_form(); Product m = new Product(); TryUpdateModel<Product>(m, form); m.IsAudit = form["IsAudit"] == "1"; m.IsRecommend = form["IsRecommend"] == "1"; m.IsTop = form["IsTop"] == "1"; m.Description = Util.Utils.ImgRemoveURL(Server.UrlDecode(m.Description)); if (m.ID == Guid.Empty) result.status = ProductService.instance().Insert(m); else result.status = ProductService.instance().Update(m); result.msg = result.status == 0 ? "操作失败" : "操作成功"; result.ResultURL = form["ResultURL"]; return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult Create(string id, string pid) { if (string.IsNullOrEmpty(id)) return Content("<script>alert(\"参数错误\");location.href=\"/\"</script>", "text/html"); Class ml = new Class(); if (CheckRoleService.instance().CheckRole_ClassID(new Guid(id), UserDateTicket.UID)) ml = ClassService.instance().GetEnumByID(new Guid(id)).FirstOrDefault(); else return Content("<script>alert(\"没有权限\")</script>", "text/html"); Product m = new Product(); if (string.IsNullOrEmpty(pid)) m = new Product(); else m = ProductService.instance().GetEnumByID(new Guid(pid)).FirstOrDefault(); ViewBag.ClassName = ml.Title; ViewBag.ClassID = ml.ID; return View(m); }