WebApplication1/Controllers/TodoController.cs
/// <summary>
/// Deletes a TodoItem by ID at the provided API key
/// </summary>
/// <param name="id">The UUID / GUID of the TodoItem</param>
/// <param name="apiKey">The API key that hosts the TodoItem</param>
/// <returns>Blank</returns>
/// <response code="200">The TodoItem was deleted successfully</response>
/// <response code="400">The request was invalid</response>
/// <response code="404">The TodoItem was not found</response>
Deletes a TodoItem by ID at the provided API key
Deletes a TodoItem by ID at the provided API key
[HttpDelete("{id}")]
        [ProducesResponseType(typeof(void), (int)HttpStatusCode.OK)]
        [ProducesResponseType(typeof(void), (int)HttpStatusCode.BadRequest)]
        [ProducesResponseType(typeof(void), (int)HttpStatusCode.NotFound)]
        public IActionResult Delete(Guid id, [FromQuery] string apiKey)
        {
            if (string.IsNullOrWhiteSpace(apiKey)) return BadRequest();
            if (apiKey.Length > 128) return BadRequest();
            var item = GetTodoItem(apiKey).RemoveAll(x => x.Id == id);
            if (item <= 0) return NotFound();
            return Ok();
        }
[ HttpDelete ( " " ) ] [ ProducesResponseType ( typeof ( void ) , ( int ) HttpStatusCode . OK ) ] [ ProducesResponseType ( typeof ( void ) , ( int ) HttpStatusCode . BadRequest ) ] [ ProducesResponseType ( typeof ( void ) , ( int ) HttpStatusCode . NotFound ) ] public IActionResult Delete ( Guid id , [ FromQuery ] string apiKey ) { if ( string . IsNullOrWhiteSpace ( apiKey ) ) return BadRequest ( ) ; if ( apiKey . Length > 128 ) return BadRequest ( ) ; var item = GetTodoItem ( apiKey ) . RemoveAll ( x => x . Id == id ) ; if ( item <= 0 ) return NotFound ( ) ; return Ok ( ) ; }
Deletes a TodoItem by ID at the provided API key
Deletes a TodoItem by ID at the provided API key
// Validation // Validation // - Null Checks // - Length Checks
None
id
Guid
The UUID / GUID of the TodoItem
The UUID / GUID of the TodoItem
string
[FromQuery]
apiKey
The API key that hosts the TodoItem
The API key that hosts the TodoItem
response
The TodoItem was deleted successfully
The TodoItem was deleted successfully
response
The request was invalid
The request was invalid
response
The TodoItem was not found
The TodoItem was not found