コード例 #1
0
        public async Task <IActionResult> PutDbbackup([FromRoute] int id, [FromBody] Dbbackup dbbackup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dbbackup.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <IActionResult> PostDbbackup([FromBody] Dbbackup dbbackup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Dbbackup.Add(dbbackup);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDbbackup", new { id = dbbackup.Id }, dbbackup));
        }