public ActionResult Create(CompanyEditModel model) { if (!ModelState.IsValid) { ModelState.AddModelError("", "请正确输入信息!"); return View(model); } CompanySvc.Insert(model.ToCompany()); return RedirectToAction("Index"); }
public ActionResult Edit(int id) { var company = CompanySvc.LoadById(id); if (company == null) { return RedirectToAction("Index"); } CompanyEditModel model = new CompanyEditModel(company); return View(model); }
public ActionResult Create() { var model = new CompanyEditModel(); return View(model); }