public ActionResult Create(string id) { Company m; if (string.IsNullOrEmpty(id)) m = new Company(); else m = CompanyService.instance().GetEnumByID(new Guid(id)).FirstOrDefault(); return View(m); }
public JsonResult Create(FormCollection form) { ResultBase_form result = new ResultBase_form(); Company m = new Company(); TryUpdateModel<Company>(m, form); m.Description = Server.UrlDecode(m.Description); if (m.ID == Guid.Empty) result.status = CompanyService.instance().Insert(m); else result.status = CompanyService.instance().Update(m); result.msg = result.status == 0 ? "操作失败" : "操作成功"; result.ResultURL = "/Company/Index"; return Json(result, JsonRequestBehavior.AllowGet); }