public bool Update(AddressViewModel dt, int id) { Address dr = db.Addresses.Where(i => i.adrID == id).FirstOrDefault(); dr.adrID = dt.ID; dr.adrLine1 = dt.LineOne; dr.adrLine2 = dt.LineTwo; dr.adrLine3 = dt.LineThree; dr.adrCity = dt.City; dr.adrState = dt.State; dr.adrZipCode = dt.ZipCode; dr.adrZipPlusFour = dt.ZipPlusFour; var Result = db.SaveChanges(); return(Result == 1); }
public int Insert(AddressViewModel dt) { Address dr = new Address(); dr.adrLine1 = dt.LineOne; dr.adrLine2 = dt.LineTwo; dr.adrLine3 = dt.LineThree; dr.adrCity = dt.City; dr.adrState = dt.State; dr.adrZipCode = dt.ZipCode; dr.adrZipPlusFour = dt.ZipPlusFour; db.Addresses.Add(dr); var Result = db.SaveChanges(); return(dr.adrID); }