public static void RegistraHackingMissione(long numeroMissione, long hacker, bool successo) { using (HolonetEntities context = new HolonetEntities()) { var ultimoProgressivo = (from trials in context.MissioneHackings select trials.Progressivo).Max(); MissioneHacking tentativoDaRegistrare = new MissioneHacking(); tentativoDaRegistrare.Progressivo = ultimoProgressivo + 1; tentativoDaRegistrare.NumeroPG = hacker; tentativoDaRegistrare.NumeroMissione = numeroMissione; tentativoDaRegistrare.Riuscito = successo ? 1 : 0; tentativoDaRegistrare.DataTentativo = DateTime.Now; context.AddToMissioneHackings(tentativoDaRegistrare); context.SaveChanges(); } }