コード例 #1
0
        public async Task <ActionResult <DFestival> > PostDFestival(DFestival dFestival)
        {
            _context.Festival.Add(dFestival);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDFestival", new { id = dFestival.Id }, dFestival));
        }
コード例 #2
0
        public async Task <IActionResult> PutDFestival(int id, DFestival dFestival)
        {
            if (id != dFestival.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }