Exemple #1
0
        public async Task <IActionResult> PutTheXe([FromRoute] int id, [FromBody] TheXe thexe)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != thexe.TheXeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PostTheXe([FromBody] TheXe thexe)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.TheXes.Add(thexe);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTheXe", new { id = thexe.TheXeId }, thexe));
        }