public int Add(PathologyEntity pathology) { try { using (var db = new CroceRossaEntities()) { db.Pat.Add(pathology.ToPat()); db.SaveChanges(); return(0); } } catch { return(-1); } }
public int Update(PathologyEntity pathology) { try { using (var db = new CroceRossaEntities()) { Pat pat = db.Pat.First(x => x.PatOwnId == pathology.Id); if (pat != null) { pat = pathology.ToPat(pat); db.SaveChanges(); } return(0); } } catch (Exception) { return(-1); } }