public async Task <IActionResult> PutDeadQuest([FromRoute] int id, [FromBody] DeadQuest deadQuest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deadQuest.Id) { return(BadRequest()); } _context.Entry(deadQuest).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeadQuestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostDeadQuest([FromBody] DeadQuest deadQuest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.DeadQuests.Add(deadQuest); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDeadQuest", new { id = deadQuest.Id }, deadQuest)); }