Class TodoService¶
Namespace: MyApp.Application
Assembly: MyApp.Application.dll
Use-case service for todo items: the only surface the API layer talks to.
Inheritance¶
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks¶
The service depends on the domain repository contract
(
Constructors¶
TodoService(ITodoRepository)¶
Initializes a new instance of the
Parameters¶
repository ITodoRepository
The backing todo repository.
Methods¶
Create(CreateTodoRequest)¶
Creates a new todo item from the given request.
Parameters¶
request CreateTodoRequest
The creation request.
Returns¶
The created item as a
Exceptions¶
Thrown when the request title is empty.
Delete(Guid)¶
Deletes a todo item.
Parameters¶
id Guid
The identifier of the item.
Returns¶
true when the item was deleted; otherwise false.
Get(Guid)¶
Returns a single todo item.
Parameters¶
id Guid
The identifier to look up.
Returns¶
The matching DTO, or null when not found.
GetAll()¶
Returns all todo items, newest last.
Returns¶
Every stored item as a
SetCompletion(Guid, bool)¶
Sets the completion state of a stored todo item.
Parameters¶
id Guid
The identifier of the item.
isCompleted bool
The new completion state.
Returns¶
The updated DTO, or null when the item does not exist.