本文整理汇总了C#中Module.GetBrokenRules方法的典型用法代码示例。如果您正苦于以下问题:C# Module.GetBrokenRules方法的具体用法?C# Module.GetBrokenRules怎么用?C# Module.GetBrokenRules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module.GetBrokenRules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public ActionResult Create(PDCPMS.Modules.Authority.Model.BlockAddModel model)
{
if (model == null || model.block == null)
{
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = "操作失败,系统发生了一个错误" };
return RedirectToAction("Add");
}
Module domainmodel = new Module(model.block.Name, model.block.AddDate, model.block.Description, model.block.Status);
ReadOnlyCollection<BrokenRule> brokenRules = domainmodel.GetBrokenRules();
if (brokenRules.Count != 0)
{
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = "你的输入有误,模块添加失败" };
TempData["BrokenRules"] = brokenRules;
TempData["InvalidModel"] = model;
}
repository.Add(domainmodel);
unitOfWork.Commit();
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("模块({0})添加成功", model.block.Name) };
return RedirectToAction("Index");
}
示例2: Update
public ActionResult Update(Module model)
{
if (model == null)
{
throw new HttpException(404, "无法找到指定的模块,请确认该模块是否存在");
}
ReadOnlyCollection<BrokenRule> brokenRules = model.GetBrokenRules();
if (brokenRules.Count != 0)
{
TempData["InvalidModel"] = model;
TempData["BrokenRules"] = brokenRules;
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = String.Format("模块({0})修改失败,请检查你的输入", model.Name) };
}
else
{
repository[model.Key] = model;
unitOfWork.Commit();
TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = String.Format("模块({0})修改成功", model.Name) };
}
return RedirectToAction("Index");
}