Exemple #1
0
 public void Add(Mutare j)
 {
     using (var context = new ExamenMppEntities())
     {
         context.Mutares.Add(j);
         context.SaveChanges();
     }
 }
Exemple #2
0
 public void Update(Mutare m)
 {
     using (var context = new ExamenMppEntities())
     {
         var oldEntity = Find(m.Id);
         context.Entry(oldEntity).CurrentValues.SetValues(m);
         context.SaveChanges();
     }
 }
Exemple #3
0
        public void HandleMutareNoua(Jucator player, IObserver client, int numarGenerat)
        {
            var joc = _jocuriActive.FirstOrDefault((pair => pair.Key.Contains(player.Username)));

            if (joc.Value.Runda >= 6)
            {
                return;
            }
            if (!joc.Value.JucatorCurent.Equals(player.Username))
            {
                client.AsteaptaRand();
            }
            else
            {
                var tabla = joc.Value.Muta(numarGenerat);
                var jct1  = _clientsDictionary[joc.Value.Jucator1];
                var jct2  = _clientsDictionary[joc.Value.Jucator2];
                jct1.Client.MutareNoua(tabla, numarGenerat);
                jct2.Client.MutareNoua(tabla, numarGenerat);

                var newJoc = new Joc();
                newJoc.Id              = joc.Value.JocDb.Id;
                newJoc.IdJucator1      = joc.Value.JocDb.IdJucator1;
                newJoc.IdJucator2      = joc.Value.JocDb.IdJucator2;
                newJoc.PozitieJucator1 = joc.Value.PozitieJucator1;
                newJoc.PozitieJucator2 = joc.Value.PozitieJucator2;
                _service.JocService.Update(newJoc);

                var mut = new Mutare();
                mut.NumarGenerat = numarGenerat;
                mut.IdJoc        = newJoc.Id;

                if (joc.Value.JucatorCurent.Equals(player.Username))
                {
                    mut.IdJucator = joc.Value.JocDb.IdJucator2;
                }
                else
                {
                    mut.IdJucator = joc.Value.JocDb.IdJucator1;
                }

                _service.MutareService.Add(new Mutare());
            }
        }
Exemple #4
0
 public void Update(Mutare c)
 {
     _repository.Add(c);
 }
Exemple #5
0
 public void Add(Mutare c)
 {
     _repository.Add(c);
 }