public async Task <ActionResult <Diy> > PostDiy(Diy diy) { _context.Diys.Add(diy); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDiy", new { id = diy.Id }, diy)); }
public async Task <IActionResult> PutDiy(int id, Diy diy) { if (id != diy.Id) { return(BadRequest()); } _context.Entry(diy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DiyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }