public void UpdateMembers(Entities.member btMem, string MemberID) { Entities.LibEntities dbCtx = new Entities.LibEntities(); Entities.member bkUpdate = dbCtx.members.First(b => b.MemberID == MemberID); BaseRepository.CopyPropertyValues(btMem, bkUpdate); dbCtx.SaveChanges(); }
private Entities.member UpdateMemDetails(Entities.member memObj) { if (txtMemMemberid.Text == "") { MessageBox.Show("Please provide a MemberID"); return(null); } else { int intStatus = 0; if (lstStatus.SelectedItem.ToString() == "Active") { intStatus = 1; } String strMemType = lstMemType.SelectedItem.ToString(); int intMemType = 0; switch (strMemType) { case "Budget": intMemType = 1; break; case "Children": intMemType = 2; break; case "Family": intMemType = 3; break; case "Individual": intMemType = 4; break; case "Unlimited": intMemType = 1; break; default: lstMemType.SelectedIndex = 0; break; } //Entities.member memObj = new member(); memObj.MemberID = txtMemMemberid.Text; memObj.MemberName = txtMemMemName.Text; memObj.Address = txtAddress.Text; memObj.Notes = txtMemNotes.Text; memObj.Doj = DateTime.Parse(dateDoj.Text); memObj.Status = intStatus; memObj.Mobile = txtMemMob.Text; memObj.Landline = txtMemland.Text; memObj.Email = txtEmail.Text; memObj.MemberType = intMemType; memObj.Amount = Int32.Parse(txtMemAmt.Text); memObj.SortID = Int32.Parse(txtMemMemberid.Text.Substring(1)); //memObj.ID = Int32.Parse(memRep.GetMemberIDDetails(txtMemMemberid.Text).Rows[0]["ID"].ToString()); } return(memObj); }
public void InsertMembers(Entities.member tranObj) { Entities.LibEntities dbCtx = new Entities.LibEntities(); dbCtx.members.Add(tranObj); dbCtx.SaveChanges(); }