本文整理汇总了C#中UserService.LogoutUser方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.LogoutUser方法的具体用法?C# UserService.LogoutUser怎么用?C# UserService.LogoutUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService.LogoutUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserModule
/// <summary>
/// Sets up HTTP methods mappings.
/// </summary>
/// <param name="service">Service handling requests</param>
public UserModule(UserService service)
: base("/v2")
{
Post["/user"] = parameters =>
{
var body = this.Bind<User>();
service.CreateUser(Context, body);
return new Response { ContentType = "application/json"};
};
Post["/user/createWithArray"] = parameters =>
{
var body = this.Bind<List<User>>();
service.CreateUsersWithArrayInput(Context, body);
return new Response { ContentType = "application/json"};
};
Post["/user/createWithList"] = parameters =>
{
var body = this.Bind<List<User>>();
service.CreateUsersWithListInput(Context, body);
return new Response { ContentType = "application/json"};
};
Delete["/user/{username}"] = parameters =>
{
var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'DeleteUser'");
service.DeleteUser(Context, username);
return new Response { ContentType = "application/json"};
};
Get["/user/{username}"] = parameters =>
{
var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'GetUserByName'");
return service.GetUserByName(Context, username);
};
Get["/user/login"] = parameters =>
{
var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Query);
var password = Parameters.ValueOf<string>(parameters, Context.Request, "password", ParameterType.Query);
return service.LoginUser(Context, username, password);
};
Get["/user/logout"] = parameters =>
{
service.LogoutUser(Context);
return new Response { ContentType = "application/json"};
};
Put["/user/{username}"] = parameters =>
{
var username = Parameters.ValueOf<string>(parameters, Context.Request, "username", ParameterType.Path);
var body = this.Bind<User>();
Preconditions.IsNotNull(username, "Required parameter: 'username' is missing at 'UpdateUser'");
service.UpdateUser(Context, username, body);
return new Response { ContentType = "application/json"};
};
}