示例#1
0
        // sets parameters for insert/update
        private Dictionary<string, object> SetParams(Roles department)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            result.Add("@departmentName", department.Name);

            return result;
        }
示例#2
0
 public ActionResult Edit(int id, Roles data)
 {
     TryUpdateModel(data);
     if (ModelState.IsValid)
     {
         dbRoles.Update(data, id);
         return RedirectToAction("Index");
     }
     return View();
 }
示例#3
0
 public ActionResult Create(Roles data)
 {
     TryUpdateModel(data);
     if (ModelState.IsValid)
     {
         dbRoles.Insert(data);
         return RedirectToAction("Index");
     }
     return View();
 }
示例#4
0
        private void AddRole()
        {
            Roles model = new Roles
            {
                RolesName = GetRequestString("name"),
                Remark = GetRequestString("remark")
            };

            if(_AuthorizeService.AddRole(model) > 0)
                Response.Write("true");
            else
                Response.Write("false");
        }
示例#5
0
 private void SaveRole()
 {
     Roles model = new Roles
     {
         Id = GetRequestString("Id").ToInt32(),
         RolesName = GetRequestString("name"),
         Remark = GetRequestString("remark")
     };
     Response.Write(_AuthorizeService.UpdateRole(model));
 }
示例#6
0
 public void Update(Roles department, int id)
 {
     ExecuteNonQuery(QueryBuilder.Update(_tableName, TargetFields, id, _pkField), SetParams(department));
 }
示例#7
0
 public void Insert(Roles department)
 {
     ExecuteNonQuery(QueryBuilder.Insert(_tableName, TargetFields), SetParams(department));
 }