本文整理汇总了C#中IRoleService.DeleteByIds方法的典型用法代码示例。如果您正苦于以下问题:C# IRoleService.DeleteByIds方法的具体用法?C# IRoleService.DeleteByIds怎么用?C# IRoleService.DeleteByIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRoleService
的用法示例。
在下文中一共展示了IRoleService.DeleteByIds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RoleModule
//.........这里部分代码省略.........
var model = _roleService.GetByAutoId(x.id);
return View["Role/Edit", model];
};
Post["/edit/{id}"] = x =>
{
ViewBag.SiteList = _siteService.GetAllSite();
ViewBag.Errored = true;
var role = this.Bind<Role>();
ValidationResult results = roleValidator.Validate(role);
if (!results.IsValid)
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", results.Errors);
}
else if (_roleService.ModifyRole(role))
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.success, "成功信息", "修改成功");
}
else
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", "未知错误,请联系管理员");
}
return View["Role/Edit", role];
};
Get["/delete/{id}"] = x =>
{
var model = _roleService.GetByAutoId((int)x.id);
_roleService.DeleteRole(model.ID);
return Response.AsRedirect("/role/list?siteId=" + model.ID.ToString());
};
Post["/delete"] = x =>
{
var result = new NotyResult();
Guid[] ids;
try
{
ids = RequestResultUtil.GetIdsByGuid(Request.Form.id);
}
catch
{
Guid strongid = new Guid(Request.Form.id);
ids = new Guid[1];
ids[0] = strongid;
}
var list = (ids ?? new Guid[0]);
if (list.Length == 0)
{
result.code = NotyType.warning.ToString();
result.msg = "你没有选择!";
}
else if (_roleService.DeleteByIds(ids))
{
result.code = NotyType.success.ToString();
result.msg = "删除成功!";
}
else
{
result.code = NotyType.error.ToString();
result.msg = "删除失败!请联系管理员!";
}
return this.Response.AsJson<NotyResult>(result);
};
Get["/vieworder"] = x =>
{
var id = new Guid(Request.Query.siteId);
return View["Role/ViewOrder", _roleService.GetAllBySiteId(id)];
};
Post["/saveorder"] = x =>
{
var result = new NotyResult();
Guid[] ids = RequestResultUtil.GetIdsByGuid(Request.Form.ids);
var list = (ids ?? new Guid[0]);
if (list.Length == 0)
{
result.code = NotyType.warning.ToString();
result.msg = "你没有选择!";
}
else if (_roleService.SetOrderByIds(ids))
{
result.code = NotyType.success.ToString();
result.msg = "排序成功";
}
else
{
result.code = NotyType.error.ToString();
result.msg = "排序失败!请联系管理员!";
}
return this.Response.AsJson<NotyResult>(result);
};
}