예제 #1
0
 public JuegoDTO GetByUuid(string Uuid)
 {
     using (ModelosDBContainer context = new ModelosDBContainer())
     {
         JuegoRepository repositorio = new JuegoRepository(context);
         if (!repositorio.Any(Uuid))
         {
             throw new Exception("Juego no existente.");
         }
         var entity = repositorio.GetByUuid(Uuid);
         return(this._mapper.Map <JuegoDTO>(entity));
     }
 }
예제 #2
0
        public bool AumentarJugados(int id)
        {
            using (ModelosDBContainer context = new ModelosDBContainer())
            {
                JuegoRepository repositorio = new JuegoRepository(context);

                if (!repositorio.Any(id))
                {
                    throw new Exception("Juego no existente.");
                }

                var juego = repositorio.Get(id);

                juego.Jugados++;
                context.SaveChanges();
            }
            return(false);
        }
예제 #3
0
        public void SetImage(int id, string url)
        {
            try
            {
                using (ModelosDBContainer context = new ModelosDBContainer())
                {
                    JuegoRepository repositorio = new JuegoRepository(context);

                    if (!repositorio.Any(id))
                    {
                        throw new Exception("Juego no existente.");
                    }

                    var juego = repositorio.Get(id);
                    juego.Caratula = url;
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }