本文整理汇总了C#中UserService.Update方法的典型用法代码示例。如果您正苦于以下问题:C# UserService.Update方法的具体用法?C# UserService.Update怎么用?C# UserService.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserService
的用法示例。
在下文中一共展示了UserService.Update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Submit_Click
/// <summary>
/// Handles the Click event of the Submit control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Submit_Click(object sender, EventArgs e)
{
if (!IsValid)
{
return;
}
//store new user information to database
UserService service = new UserService();
User user = service.GetByID(UserID);
ProfileControl1.FillUser(user);
service.Update(user);
}
示例2: SubmitButton_Click
/// <summary>
/// Handles the Click event of the SubmitButton control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void SubmitButton_Click(object sender, EventArgs e)
{
StatusLabel.Visible = false;
if (!Page.IsValid)
{
return;
}
ProfileControl1.FillUser(Global.LoggedInUser);
UserService service = new UserService();
service.Update(Global.LoggedInUser);
StatusLabel.Text = "Your profile has been updated.";
StatusLabel.Visible = true;
}
示例3: Update
public override void Update()
{
UserService target = new UserService();
User user = (User) CreateRecord();
Insert(user);
user.LastName = "updated last name";
target.Update(user);
User updated = target.GetByID(user.ID);
Assert.AreEqual(user.LastName, updated.LastName);
}
示例4: Edit
public ActionResult Edit(int id, EditUserModel model)
{
try
{
if (ModelState.IsValid)
{
User user = new User()
{
UserID = model.UserID,
UserName = model.Username,
Password = model.Password,
Email = model.Email,
Description = model.Description,
FullName = model.Fullname,
Occupation = model.Occupation,
Address = model.Address,
Industry = model.Industry,
AnualIcome = model.AnualIncome,
BirthYear = model.BirthYear,
UserTypeID = model.UserTypeId,
PhoneNumber1 = model.Phone1,
PhoneNumber2 = model.Phone2,
PhoneNumber3 = model.Phone3,
//CreatedUserID = SessionManager.UserInfo.UserID,
UpdatedUserID = SessionManager.UserInfo.UserID,
GroupID = model.GroupID,
};
if (model.PartnerId > .0)
{
user.PartnerId = model.PartnerId;
}
UserService service = new UserService();
service.Update(user);
return RedirectToAction("Index");
}
// TODO: Add update logic here
}
catch (Exception ex)
{
Logger.Log(ex);
ModelState.AddModelError("Error500", ex.Message);
}
return View(model);
}