public int Add(DataCollectionEntity dataList) { try { using (var db = new CroceRossaEntities()) { db.Ins.Add(dataList.ToIns()); db.SaveChanges(); return(0); } } catch (Exception ex) { return(-1); } }
public int Update(DataCollectionEntity dataList) { try { using (var db = new CroceRossaEntities()) { Ins ins = db.Ins.First(x => x.InsOwnId == dataList.Id); if (ins != null) { ins = dataList.ToIns(ins); db.SaveChanges(); } return(0); } } catch (Exception) { return(-1); } }