本文整理汇总了C#中IJabbrRepository.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# IJabbrRepository.Remove方法的具体用法?C# IJabbrRepository.Remove怎么用?C# IJabbrRepository.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJabbrRepository
的用法示例。
在下文中一共展示了IJabbrRepository.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveZombies
private static void RemoveZombies(ILogger logger, IJabbrRepository repo)
{
// Remove all zombie clients
var zombies = repo.Clients.Where(c =>
SqlFunctions.DateDiff("mi", c.LastActivity, DateTimeOffset.UtcNow) > 3);
// We're doing to list since there's no MARS support on azure
foreach (var client in zombies.ToList())
{
logger.Log("Removed zombie connection {0}", client.Id);
repo.Remove(client);
}
}
示例2: AccountModule
//.........这里部分代码省略.........
return this.SignIn(Principal.Claims);
}
}
}
catch (Exception ex)
{
this.AddValidationError("_FORM", ex.Message);
}
return View["register"];
};
Post["/unlink"] = param =>
{
if (!IsAuthenticated)
{
return HttpStatusCode.Forbidden;
}
string provider = Request.Form.provider;
ChatUser user = repository.GetUserById(Principal.GetUserId());
if (user.Identities.Count == 1 && !user.HasUserNameAndPasswordCredentials())
{
Request.AddAlertMessage("error", "You cannot unlink this account because you would lose your ability to login.");
return Response.AsRedirect("~/account/#identityProviders");
}
var identity = user.Identities.FirstOrDefault(i => i.ProviderName == provider);
if (identity != null)
{
repository.Remove(identity);
Request.AddAlertMessage("success", String.Format("Successfully unlinked {0} account.", provider));
return Response.AsRedirect("~/account/#identityProviders");
}
return HttpStatusCode.BadRequest;
};
Post["/newpassword"] = _ =>
{
if (!IsAuthenticated)
{
return HttpStatusCode.Forbidden;
}
string password = Request.Form.password;
string confirmPassword = Request.Form.confirmPassword;
ValidatePassword(password, confirmPassword);
ChatUser user = repository.GetUserById(Principal.GetUserId());
try
{
if (ModelValidationResult.IsValid)
{
membershipService.SetUserPassword(user, password);
repository.CommitChanges();
}
}
catch (Exception ex)
{
示例3: AccountModule
//.........这里部分代码省略.........
{
ChatUser user = membershipService.AddUser(username, email, password);
return this.CompleteLogin(authenticationTokenService, user);
}
}
catch (Exception ex)
{
this.AddValidationError("_FORM", ex.Message);
}
return View["register"];
};
Post["/unlink"] = param =>
{
if (Context.CurrentUser == null)
{
return HttpStatusCode.Forbidden;
}
string provider = Request.Form.provider;
ChatUser user = repository.GetUserById(Context.CurrentUser.UserName);
if (user.Identities.Count == 1 && !user.HasUserNameAndPasswordCredentials())
{
this.AddAlertMessage("error", "You cannot unlink this account because you would lose your ability to login.");
return Response.AsRedirect("~/account/#identityProviders");
}
var identity = user.Identities.FirstOrDefault(i => i.ProviderName == provider);
if (identity != null)
{
repository.Remove(identity);
this.AddAlertMessage("success", String.Format("Successfully unlinked {0} account.", provider));
return Response.AsRedirect("~/account/#identityProviders");
}
return HttpStatusCode.BadRequest;
};
Post["/newpassword"] = _ =>
{
if (Context.CurrentUser == null)
{
return HttpStatusCode.Forbidden;
}
string password = Request.Form.password;
string confirmPassword = Request.Form.confirmPassword;
ValidatePassword(password, confirmPassword);
ChatUser user = repository.GetUserById(Context.CurrentUser.UserName);
try
{
if (ModelValidationResult.IsValid)
{
membershipService.SetUserPassword(user, password);
repository.CommitChanges();
}
}
catch (Exception ex)
{
示例4: AccountModule
//.........这里部分代码省略.........
catch (Exception ex)
{
this.AddValidationError("_FORM", ex.Message);
}
return View["register"];
};
Post["/unlink"] = param =>
{
if (!HasValidCsrfTokenOrSecHeader)
{
return HttpStatusCode.Forbidden;
}
if (!IsAuthenticated)
{
return HttpStatusCode.Forbidden;
}
string provider = Request.Form.provider;
ChatUser user = repository.GetUserById(Principal.GetUserId());
if (user.Identities.Count == 1 && !user.HasUserNameAndPasswordCredentials())
{
Request.AddAlertMessage("error", LanguageResources.Account_UnlinkRequiresMultipleIdentities);
return Response.AsRedirect("~/account/#identityProviders");
}
var identity = user.Identities.FirstOrDefault(i => i.ProviderName == provider);
if (identity != null)
{
repository.Remove(identity);
Request.AddAlertMessage("success", String.Format(LanguageResources.Account_UnlinkCompleted, provider));
return Response.AsRedirect("~/account/#identityProviders");
}
return HttpStatusCode.BadRequest;
};
Post["/newpassword"] = _ =>
{
if (!HasValidCsrfTokenOrSecHeader)
{
return HttpStatusCode.Forbidden;
}
if (!IsAuthenticated)
{
return HttpStatusCode.Forbidden;
}
string password = Request.Form.password;
string confirmPassword = Request.Form.confirmPassword;
ValidatePassword(password, confirmPassword);
ChatUser user = repository.GetUserById(Principal.GetUserId());
try
{
if (ModelValidationResult.IsValid)
{
membershipService.SetUserPassword(user, password);