コード例 #1
0
 public ActionResult Create(string parentId)
 {
     var a = new OrgModel();
     if (parentId != null)
     {
         a.Parent = _factory.CreateOrgDao().Get(parentId);
     }
     return View(a);
 }
コード例 #2
0
        public ActionResult Save(OrgModel org)
        {
            if (ModelState.IsValid)
            {
                IOrgDao orgDao = _factory.CreateOrgDao();
                org.Save(orgDao);
                if (org.Parent == null)
                {
                    return RedirectToAction("Index");
                }
                return RedirectToAction("Index", new { id = org.Parent.Id });
            }

            return View(String.IsNullOrEmpty(org.Id) ? "Create" : "Edit", org);
        }