Exemple #1
0
        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);
            }
        }
Exemple #2
0
 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);
     }
 }