// 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; }
public ActionResult Edit(int id, Roles data) { TryUpdateModel(data); if (ModelState.IsValid) { dbRoles.Update(data, id); return RedirectToAction("Index"); } return View(); }
public ActionResult Create(Roles data) { TryUpdateModel(data); if (ModelState.IsValid) { dbRoles.Insert(data); return RedirectToAction("Index"); } return View(); }
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"); }
private void SaveRole() { Roles model = new Roles { Id = GetRequestString("Id").ToInt32(), RolesName = GetRequestString("name"), Remark = GetRequestString("remark") }; Response.Write(_AuthorizeService.UpdateRole(model)); }
public void Update(Roles department, int id) { ExecuteNonQuery(QueryBuilder.Update(_tableName, TargetFields, id, _pkField), SetParams(department)); }
public void Insert(Roles department) { ExecuteNonQuery(QueryBuilder.Insert(_tableName, TargetFields), SetParams(department)); }