double the click the button to generate the event handler. copy and paste following codes .
private void button1_Click(object sender, EventArgs e)
{
Cashir ca = Setinfromation(Convert.ToInt32(textBox3.Text), textBox1.Text, textBox2.Text);
bool result = UpdateUserDetails(ca);
label3.Text = "Record is update";
}
public bool UpdateUserDetails(Cashir ca)
{
bool result = false;
using (UserEntities user_entity = new UserEntities())
{
Cashir cashir = user_entity.Cashirs.Where(x => x.User_Id == ca.User_Id).Select(x => x).FirstOrDefault();
cashir.username = ca.username;
cashir.password = ca.password;
user_entity.SaveChanges();
result = true;
}
return result;
}
public Cashir Setinfromation(int User_Id, string userame, string password)
{
Cashir ca = new Cashir();
ca.User_Id = User_Id;
ca.username = userame;
ca.password = password;
return ca;
}
}
}
first provide the user id the enter the information into textbox then click the update button .
No comments:
Post a Comment