public int Add(AuthorityEntity entity)
        {
            try
            {
                using (var db = new CroceRossaEntities())
                {
                    db.Ent.Add(entity.ToEnt());
                    db.SaveChanges();

                    return(0);
                }
            }
            catch
            {
                return(-1);
            }
        }
 public int Update(AuthorityEntity entity)
 {
     try
     {
         using (var db = new CroceRossaEntities())
         {
             Ent ent = db.Ent.First(x => x.EntOwnId == entity.Id);
             if (ent != null)
             {
                 ent = entity.ToEnt(ent);
                 db.SaveChanges();
             }
             return(0);
         }
     }
     catch (Exception)
     {
         return(-1);
     }
 }