本文整理汇总了C#中IBrightstarService.RevertToCommitPoint方法的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService.RevertToCommitPoint方法的具体用法?C# IBrightstarService.RevertToCommitPoint怎么用?C# IBrightstarService.RevertToCommitPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBrightstarService
的用法示例。
在下文中一共展示了IBrightstarService.RevertToCommitPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommitPointsModule
public CommitPointsModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider permissionsProvider)
{
this.RequiresBrightstarStorePermission(permissionsProvider, get:StorePermissions.ViewHistory, post:StorePermissions.Admin);
Get["/{storeName}/commits"] = parameters =>
{
int skip = Request.Query["skip"].TryParse<int>(0);
int take = Request.Query["take"].TryParse<int>(DefaultPageSize);
DateTime timestamp = Request.Query["timestamp"].TryParse<DateTime>();
DateTime earliest = Request.Query["earliest"].TryParse<DateTime>();
DateTime latest = Request.Query["latest"].TryParse<DateTime>();
var request = this.Bind<CommitPointsRequestModel>();
ViewBag.Title = request.StoreName + " - Commit History";
if (timestamp != default(DateTime))
{
// Request for a single commit point
var commitPoint = brightstarService.GetCommitPoint(parameters["storeName"], timestamp);
return commitPoint == null ? HttpStatusCode.NotFound : MakeResponseObject(commitPoint);
}
if (earliest != default(DateTime) && latest != default(DateTime))
{
IEnumerable<ICommitPointInfo> results =
brightstarService.GetCommitPoints(parameters["storeName"], latest, earliest, skip, take + 1);
var resourceUri = String.Format("commits?latest={0}&earliest={1}", latest.ToString("s"), earliest.ToString("s"));
return Negotiate.WithPagedList(request, results.Select(MakeResponseObject), skip, take, DefaultPageSize, resourceUri);
}
IEnumerable<ICommitPointInfo> commitPointInfos = brightstarService.GetCommitPoints(parameters["storeName"], skip, take + 1);
return Negotiate.WithPagedList(request, commitPointInfos.Select(MakeResponseObject), skip, take, DefaultPageSize, "commits");
};
Post["/{storeName}/commits"] = parameters =>
{
var commitPoint = this.Bind<CommitPointResponseModel>();
if (commitPoint == null ||
String.IsNullOrEmpty(commitPoint.StoreName) ||
!commitPoint.StoreName.Equals(parameters["storeName"]))
{
return HttpStatusCode.BadRequest;
}
var commitPointInfo = brightstarService.GetCommitPoint(parameters["storeName"], commitPoint.Id);
if (commitPointInfo == null) return HttpStatusCode.BadRequest;
brightstarService.RevertToCommitPoint(parameters["storeName"], commitPointInfo);
return HttpStatusCode.OK;
};
}