public async Task DeleteToDoListTest()
        {
            int result = await _toDoListContract.DeleteToDoList(1, 1);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result);
        }
Beispiel #2
0
        public async Task <IActionResult> DeleteToDoList([Required] long id)
        {
            long userId      = long.Parse(HttpContext.Items["UserId"].ToString());
            int  deletedItem = await _toDoListContract.DeleteToDoList(id, userId);

            if (deletedItem == 1)
            {
                return(Ok(
                           new ApiResponse <object>
                {
                    IsSuccess = true,
                    Result = "Deleted",
                    Message = "ToDoList with ID = " + id + "is deleted by UserId = " + userId + "."
                }));
            }
            return(NotFound(
                       new ApiResponse <string>
            {
                IsSuccess = true,
                Result = "Not found.",
                Message = "No data exist for Id = " + id + "."
            }));
        }