Beispiel #1
0
        public async Task <WrapperSimpleTypesDTO> CrearNoticia(Noticias crearNoticia)
        {
            using (SportsGoEntities context = new SportsGoEntities(false))
            {
                NoticiasRepository noticiaRepo = new NoticiasRepository(context);

                crearNoticia.Creacion = DateTime.Now;
                noticiaRepo.CrearNoticia(crearNoticia);

                WrapperSimpleTypesDTO wrapperCrearNoticia = new WrapperSimpleTypesDTO();

                wrapperCrearNoticia.NumeroRegistrosAfectados = await context.SaveChangesAsync();

                if (wrapperCrearNoticia.NumeroRegistrosAfectados > 0)
                {
                    wrapperCrearNoticia.Exitoso           = true;
                    wrapperCrearNoticia.ConsecutivoCreado = crearNoticia.Consecutivo;
                }

                return(wrapperCrearNoticia);
            }
        }