Exemple #1
0
        public async Task <ActionResult <Rapport_Temps> > PostRapport_Temps(Rapport_Temps rapport_Temps)
        {
            _context.Rapport_Temps.Add(rapport_Temps);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRapport_Temps", new { id = rapport_Temps.Id }, rapport_Temps));
        }
Exemple #2
0
        public List <Rapport_Temps> Rapport_Temps_Festival(int FestivalId)
        {
            List <Rapport_Temps> rapport_Temps = new List <Rapport_Temps>();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                string     sqlQuery = "Select * from Rapport_Temps where FestivalId = " + FestivalId;
                SqlCommand command  = new SqlCommand(sqlQuery, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Rapport_Temps rapport = new Rapport_Temps();

                        rapport.Id = reader.GetInt32(0);
                        rapport.Date_Inscription   = reader.GetDateTime(1);
                        rapport.FestivalId         = reader.GetInt32(2);
                        rapport.Nombre_Inscription = reader.GetInt32(3);

                        rapport_Temps.Add(rapport);
                    }
                }
            }
            return(rapport_Temps);
        }
Exemple #3
0
        public async Task <IActionResult> PutRapport_Temps(int id, Rapport_Temps rapport_Temps)
        {
            if (id != rapport_Temps.Id)
            {
                return(BadRequest());
            }

            _context.Entry(rapport_Temps).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Rapport_TempsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }