本文整理汇总了C#中ISiteService.GetSite方法的典型用法代码示例。如果您正苦于以下问题:C# ISiteService.GetSite方法的具体用法?C# ISiteService.GetSite怎么用?C# ISiteService.GetSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISiteService
的用法示例。
在下文中一共展示了ISiteService.GetSite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SiteModule
public SiteModule(ISiteService _siteService)
: base("/site")
{
SiteValidator sitevalidator = new SiteValidator();
Get["/list"] = x =>
{
return View["Site/List",_siteService.GetAllSite()];
};
Get["/add"] = x =>
{
return View["Site/Add",new Site()];
};
Post["/add"] = x =>
{
var site = this.Bind<Site>();
ViewBag.Errored = true;
ValidationResult results = sitevalidator.Validate(site);
if (!results.IsValid)
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", results.Errors);
}
else if (_siteService.CreateSite(site))
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.success, "成功信息","添加网站成功");
}
else
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", "未知错误,请联系管理员");
}
return View["Site/Add",site];
};
Get["/edit/{id}"] = x =>
{
var model = _siteService.GetSite((int)x.id);
return View["Site/Edit", model];
};
Post["/edit/{id}"] = x =>
{
var site = this.Bind<Site>();
ViewBag.Errored = true;
ValidationResult results = sitevalidator.Validate(site);
if (!results.IsValid)
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", results.Errors);
}
else if (_siteService.ModifySite(site))
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.success, "成功信息", "修改网站成功");
}
else
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", "未知错误,请联系管理员");
}
return View["Site/Edit", site];
};
Get["/delete/{id}"] = x =>
{
_siteService.DeleteSite((int)x.id);
return Response.AsRedirect("/site/list");
};
Get["/editdomain/{id}"] = x =>
{
var model = _siteService.GetSite((int)x.id);
return View["Site/EditDomain", model];
};
Post["/adddomain"] = x =>
{
var domainName = Request.Form.domain.ToString();
var id = new Guid(Request.Form.id.ToString());
var result = new NotyResult();
if (String.IsNullOrEmpty(domainName))
{
result.code = NotyType.warning.ToString();
result.msg = "域名不能为空!";
}
else if (!_siteService.IsDomainOnly(id,domainName))
{
result.code = NotyType.warning.ToString();
result.msg = "域名已存在!";
}
else if (_siteService.AddDomain(id,domainName))
{
result.code = NotyType.success.ToString();
result.msg = "添加成功";
}
else
{
result.code = NotyType.error.ToString();
result.msg = "添加失败!请联系管理员!";
}
return this.Response.AsJson<NotyResult>(result);
};
//.........这里部分代码省略.........
示例2: PermissionModule
public PermissionModule(ISiteService _siteService,
IPermissionGroupService _permissionGroupService,
IMiscService _miscService,
IPermissionItemService _permissionItemService)
: base("/permission")
{
PermissionGroupValidator permissionGroupValidator = new PermissionGroupValidator();
PermissionItemValidator permissionItemValidator = new PermissionItemValidator();
Get["/list"] = x =>
{
ViewBag.SiteId = Request.Query.siteId;
ViewBag.SiteList = _siteService.GetAllSite();
Guid siteid;
if (!String.IsNullOrEmpty(Request.Query.siteId))
{
siteid = new Guid(Request.Query.siteId);
}
else
{
siteid = new Guid();
}
return View["Permission/List", _miscService.GetPermissionGroupItemsBySiteId(siteid)];
};
Get["/addgroup"] = x =>
{
ViewBag.SiteId = Request.Query.siteId;
ViewBag.SiteList = _siteService.GetAllSite();
return View["Permission/AddGroup", new PermissionGroup()];
};
Post["/addgroup"] = x =>
{
ViewBag.Errored = true;
var permissiongroup = this.Bind<PermissionGroup>();
ViewBag.SiteId = Request.Query.siteId;
ViewBag.SiteList = _siteService.GetAllSite();
ValidationResult results = permissionGroupValidator.Validate(permissiongroup);
if (!results.IsValid)
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", results.Errors);
}
else if (_permissionGroupService.CreatePermissionGroup(permissiongroup))
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.success, "成功信息", "添加成功");
}
else
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", "未知错误,请联系管理员");
}
return View["Permission/AddGroup", permissiongroup];
};
Get["/additem"] = x =>
{
var permissiongroupid = Request.Query.permissiongroupid;
var siteid = Request.Query.siteid;
ViewBag.SiteId = siteid;
ViewBag.PermissionGroupId = permissiongroupid;
ViewBag.SiteName = _siteService.GetSite(new Guid(siteid)).SiteName;
ViewBag.PermissionGroupList = _permissionGroupService.GetAllBySiteId(new Guid(siteid));
return View["Permission/AddItem", new PermissionItem()];
};
Post["/additem"] = x =>
{
var permissiongroupid = Request.Query.permissiongroupid;
var siteid = Request.Query.siteid;
ViewBag.SiteId = siteid;
ViewBag.Errored = true;
ViewBag.PermissionGroupId = permissiongroupid;
ViewBag.SiteName = _siteService.GetSite(new Guid(siteid)).SiteName;
ViewBag.PermissionGroupList = _permissionGroupService.GetAllBySiteId(new Guid(siteid));
var permissionitem = this.Bind<PermissionItem>();
ValidationResult results = permissionItemValidator.Validate(permissionitem);
if (!results.IsValid)
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", results.Errors);
}
else if (_permissionItemService.CreatePermissionItem(permissionitem))
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.success, "成功信息", "添加成功");
}
else
{
ViewBag.ErrorMsg = HtmlUtils.GetCharisma_Alert(Charisma_AlertType.error, "错误信息", "未知错误,请联系管理员");
}
return View["Permission/AddItem", permissionitem];
};
Post["/deleteitem"] = x =>
{
var result = new NotyResult();
Guid[] ids;
try
{
ids = RequestResultUtil.GetIdsByGuid(Request.Form.id);
}
//.........这里部分代码省略.........