本文整理汇总了C#中Entities.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.Verify方法的具体用法?C# Entities.Verify怎么用?C# Entities.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.Verify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public Entities.Queue Insert(Entities.Queue queue)
{
if (queue.Verify())
{
StringBuilder query = new StringBuilder();
query.AppendLine("IF NOT EXISTS(SELECT [Id] FROM [Core].[Queue] Q WHERE Q.[Name] = @Name)");
query.AppendLine("BEGIN");
query.AppendLine(" INSERT INTO [Core].[Queue]");
query.AppendLine(" (");
query.AppendLine(" [Name],");
query.AppendLine(" [MaxWokers]");
query.AppendLine(" )");
query.AppendLine(" VALUES");
query.AppendLine(" (");
query.AppendLine(" @Name,");
query.AppendLine(" @MaxWokers");
query.AppendLine(" )");
query.AppendLine("END");
query.AppendLine("SELECT * FROM [Core].[Queue] Q WHERE Q.[Name] = @Name");
using (IDbConnection connection = database.CreateConnection())
{
queue = connection.Query<Entities.Queue>(query.ToString(), new
{
Name = queue.Name,
MaxWokers = queue.MaxWokers
}).FirstOrDefault();
}
return queue;
}
return null;
}
示例2: Execute
public Entities.Branch Execute(Entities.Branch branch)
{
branch.Verify();
Entities.Branch result = insertDAL.Execute(branch);
queueBLL.Insert(new Queue { MaxWokers = 1, Name = result.Name });
return result;
}
示例3: Save
public ActionResult Save(Entities.Branch branch)
{
try
{
branch.Verify();
}
catch(FluentValidation.ValidationException e)
{
Dictionary<string, bool> errors = new Dictionary<string, bool>();
foreach (var error in e.Errors)
{
errors.Add(error.PropertyName, true);
}
return Json(new { Error = errors });
}
insertBLL.Execute(branch);
return Json(new { Url = Url.Action("Index", "BranchList") });
}