Exemple #1
0
        public async Task <IActionResult> PutTformation(short id, Tformation tformation)
        {
            if (id != tformation.TformationId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <ActionResult <Tformation> > PostTformation(Tformation tformation)
        {
            _context.Tformation.Add(tformation);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TformationExists(tformation.TformationId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTformation", new { id = tformation.TformationId }, tformation));
        }