本文整理汇总了C#中DataAccess.GetPageByGuid方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.GetPageByGuid方法的具体用法?C# DataAccess.GetPageByGuid怎么用?C# DataAccess.GetPageByGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess.GetPageByGuid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
public ActionResult Delete(string id)
{
var db = new DataAccess();
var model = new WikiModel();
try
{
var page = db.GetPageByGuid(id);
model.Guid = page.Guid;
model.Author = db.GetUserById(page.Author).Full_name;
model.CreatedOn = page.Created_on;
model.ModifiedOn = page.Modified_on;
model.Title = page.Title;
model.Body = page.Body;
}
catch (Exception ex)
{
ViewBag.Error = ex.Message;
return View("Error");
}
return View(model);
}
示例2: Edit
public ActionResult Edit(string id)
{
var db = new DataAccess();
if (!String.IsNullOrEmpty(id))
{
var page = db.GetPageByGuid(id);
if (page != null)
{
var model = new WikiModel()
{
Guid = page.Guid,
CreatedOn = page.Created_on,
ModifiedOn = page.Modified_on,
Author = db.GetUserById(page.Author).Full_name,
Title = page.Title,
Body = page.Body
};
return View(model);
}
}
// We probably should have found the page unless somebody is tampering
// or it was deleted prior to us getting here
return RedirectToAction("Index");
}