public async Task <IActionResult> PutSection(int id, Section section)
        {
            if (id != section.IdSection)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutAbonnement(int id, Abonnement abonnement)
        {
            if (id != abonnement.IdAbonnement)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutVoir(string id, Voir voir)
        {
            if (id != voir.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #4
0
        public async Task <IActionResult> PutMessage(int id, Message message)
        {
            if (id != message.IdMessage)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #5
0
        public async Task <IActionResult> PutAspNetUserRoles(string id, AspNetUserRoles aspNetUserRoles)
        {
            if (id != aspNetUserRoles.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutReferencer(int id, Referencer referencer)
        {
            if (id != referencer.IdTag)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutChangement(string id, [FromBody] Changement changement)
        {
            _context.Entry(changement).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();

                Article articleToModify = _context.Article.Find(changement.IdArticle);

                articleToModify.TitreArticle       = changement.TitreChangement;
                articleToModify.TextArticle        = changement.TextChangement;
                articleToModify.DescriptionArticle = changement.DescriptionChangement;

                Logwritter log = new Logwritter("ChangementID : " + changement.IdChangement + " l'etat a été modifié par " + id);
                log.writeLog();


                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }

            return(NoContent());
        }
        public async Task<IActionResult> PutArticle(string id, [FromBody]Article article)
        {
           
            _context.Entry(article).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                
                    return NotFound();
                
            }

            Logwritter log = new Logwritter("ArticleID : " + article.IdArticle + " l'etat a été modifié par " + id);
            log.writeLog();

            return NoContent();
        }