コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var todo = await _todoRepo.GetTodoByID(id);

            _todoRepo.Delete(todo);
            if (await _todoRepo.Save())
            {
                await hub.Clients.All.SendAsync("ReceivedMessage");

                return(Ok($"Todo with id {id} deleted successfully!"));
            }
            return(StatusCode(StatusCodes.Status500InternalServerError, $"Todo with id: {id} could not be deleted"));
        }