public int Add(AddressEntity address) { try { using (var db = new CroceRossaEntities()) { db.Ind.Add(address.ToInd()); db.SaveChanges(); return(0); } } catch { return(-1); } }
public int Update(AddressEntity address) { try { using (var db = new CroceRossaEntities()) { Ind ind = db.Ind.First(x => x.IndOwnId == address.Id); if (ind != null) { ind = address.ToInd(ind); db.SaveChanges(); } return(0); } } catch (Exception) { return(-1); } }