本文整理汇总了C#中User.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# User.Delete方法的具体用法?C# User.Delete怎么用?C# User.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.Delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteUser
public int DeleteUser(int userid)
{
User a = new User();
int i= a.Delete(userid);
if (i == 1)
return 1;
else
return 0;
}
示例2: Given_user_trying_to_delete_themselves_When_Delete_Then_should_throw_correct_exception
public void Given_user_trying_to_delete_themselves_When_Delete_Then_should_throw_correct_exception()
{
// Given
var user = new User {Id = Guid.NewGuid()};
// When
// Then
Assert.Throws<UserAttemptingToDeleteSelfException>(() => user.Delete(new UserForAuditing()
{
Id = user.Id
}));
}
示例3: When_Delete_Then_should_set_correct_properties
public void When_Delete_Then_should_set_correct_properties()
{
// Given
var user = new User { Id = Guid.NewGuid() };
var userDeleting = new UserForAuditing();
// When
user.Delete(userDeleting);
// Then
Assert.That(user.Deleted, Is.True);
Assert.That(user.LastModifiedBy, Is.EqualTo(userDeleting));
Assert.That(user.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
Assert.That(user.DateDeleted.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
}
示例4: DataGrid1_ItemCommand
protected void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string btn=e.CommandName;
switch(btn)
{
case "BtnEdit":
int userID1=int.Parse(e.Item.Cells[9].Text.Trim());
Response.Redirect("../userupdate.aspx?userid="+userID1);
break;
case "BtnDel":
int userID2=int.Parse(e.Item.Cells[9].Text.Trim());
User currentUser2 = new User(userID2);
currentUser2.Delete();
break;
}
dataBind();
}
示例5: ExecuteActionOnUserNotPresentInImport
protected virtual bool ExecuteActionOnUserNotPresentInImport(User user, ref string errorMessage)
{
if (user != null)
{
user.Delete();
return true;
}
errorMessage += "The user was null in the ExecuteActionOnUserNotPresentInImport method. The user was not processed. ";
return false;
}