public vDepartment(Department department) { this.ID = department.ID; this.DepartmentName = department.DepartmentName; this.Remark = department.Remark; this.IsDelete = department.IsDelete; this.AddTime = department.AddTime.ToString(); }
/// <summary> /// 执行部门增加 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult DoAdd(Department model) { AjaxModel ajaxModel = new AjaxModel(); try { IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL; model.IsDelete = false; model.AddTime = DateTime.Now; bll.Add(model); ajaxModel.Statu = "ok"; ajaxModel.Msg = "增加成功"; ajaxModel.BackUrl = "/Admin/Department/Index"; } catch { ajaxModel.Statu = "err"; ajaxModel.Msg = "增加失败"; } return Json(ajaxModel); }
/// <summary> /// 执行修改 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult DoUpdate(Department model) { Department department = new Department(); AjaxModel ajaxModel = new AjaxModel(); try { IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL; department = bll.GetListBy(d => d.ID == model.ID).SingleOrDefault(); department.DepartmentName = model.DepartmentName; department.Remark = model.Remark; bll.Modify(department, "DepartmentName", "Remark"); ajaxModel.Statu = "ok"; ajaxModel.Msg = "修改成功!"; ajaxModel.BackUrl = "/Admin/Department/Index"; } catch { ajaxModel.Statu = "err"; ajaxModel.Msg = "修改失败!"; } return Json(ajaxModel); }
public ActionResult Update(int id) { Department department = new Department(); IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL; department = bll.GetListBy(d => d.ID == id).SingleOrDefault(); ViewBag.Department = department; return View(); }