public ActionResult Create(FormCollection collection)
 {
     using (var session = new SessionFactory().OpenSession())
     {
         var model = new Organization();
         TryUpdateModel(model, collection.ToValueProvider());
         if (!ModelState.IsValid)
         {
             return View(model);
         }
         if (session.Load<Organization>(m => m.Name.Equals(model.Name)) != null)
         {
             FlashFailure("部门[{0}]已经存在", model.Name);
             return View(model);
         }
         model.CreatedAt = DateTime.Now;
         model.CreatedBy = CurrentAccountNo;
         ViewData.Model = model;
         if (session.Create(model))
         {
             FlashSuccess("部门[{0}]创建成功", model.Name);
             return Close();
         }
         FlashFailure("创建部门[{0}]失败!", model.Name);
         return View();
     }
 }
 public static SelectList OrganizationList()
 {
     Session ds = new SessionFactory().OpenSession();
     IList<Organization> d = ds.Find<Organization>();
     var item = new Organization {Id = 0, Name = "无"};
     d.Add(item);
     return new SelectList(d, "Id", "Name");
 }