Пример #1
0
        public async Task <ActionResult <EdtItem> > Post(EdtItem item)
        {
            if (alreadyExist(item))
            {
                return(BadRequest());
            }

            _context.EdtItem.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetById), new { id = item.idItem }, item));
        }
Пример #2
0
        public async Task <ActionResult <Period> > Post(Period period)
        {
            //La BDD est en auto-increment : si !=0 --> erreur
            if (period.id_period != 0)
            {
                return(BadRequest());
            }

            if (alreadyExist(period))
            {
                return(BadRequest());
            }

            _context.Period.Add(period);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetById), new { id = period.id_period }, period));
        }
Пример #3
0
        public async Task <ActionResult <Uemodule> > PostPeriod(Uemodule uemodule)
        {
            //La BDD est en auto-increment : si !=0 --> erreur
            if (uemodule.id_uemod != 0)
            {
                return(BadRequest());
            }

            if (alreadyExist(uemodule))
            {
                return(BadRequest());
            }

            _context.Uemodule.Add(uemodule);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetById), new { id = uemodule.id_uemod }, uemodule));
        }