예제 #1
0
        public async Task <ActionResult <Plaint> > PostPlaint(Plaint plaint)
        {
            _context.plaints.Add(plaint);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPlaint", new { id = plaint.Id }, plaint));
        }
예제 #2
0
        public async Task <IActionResult> PutPlaint(int id, Plaint plaint)
        {
            if (id != plaint.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }