public async Task <IActionResult> PostTodotbl([FromBody] Todotbl todotbl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Todotbl.Add(todotbl); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TodotblExists(todotbl.TaskId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } //return BadRequest(); } return(CreatedAtAction("GetTodotbl", new { id = todotbl.TaskId }, todotbl)); }
public async Task <IActionResult> PutTodotbl([FromRoute] int id, [FromBody] Todotbl todotbl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != todotbl.TaskId) { return(BadRequest()); } _context.Entry(todotbl).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodotblExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }