public ToDoListTaskResponse CreateToDoListTask(int listId, ToDoListTaskRequest item) { try { _log.Debug("Create task"); _toDoListManager.AddTaskToList(listId, Mapper.Map <ToDoListTask>(item)); _log.Debug("Send result success create task"); var task = _toDoListManager.GetListItemDetail(listId).Tasks.LastOrDefault(u => u.Text == item.Text && u.IsCompleted == item.IsCompleted && u.CreateDate == item.CreateDate); return(new ToDoListTaskResponse { StatusCode = 201, Message = "SUCCESS", Data = task //_toDoListManager.GetListItemDetail(listId).Tasks.Last() }); //_toDoListManager.GetListItemDetail(listId).Tasks.Last() }; //item _log.Info("Created task"); } catch (ToDoListException ex) { _log.Error(ex); return(new ToDoListTaskResponse { Message = ex.Message }); } catch (Exception ex) { _log.Error(ex); return(new ToDoListTaskResponse { Message = ex.Message }); } }
public ToDoListItemResponse GetDetails(int id) { try { _log.Debug("Get listItemDetails"); var listItemDetail = _toDoListManager.GetListItemDetail(id); _log.Debug("Check value listItemDetail is null"); if (listItemDetail == null) { _log.Debug("Send result not found listItemDetail"); return(new ToDoListItemResponse { StatusCode = 404, Message = "NOT FOUND" }); } _log.Debug("Send result success get listItemDetails"); return(new ToDoListItemResponse { StatusCode = 200, Message = "SUCCESS", Data = listItemDetail }); } catch (ToDoListException ex) { _log.Error(ex); return(new ToDoListItemResponse { Message = ex.Message }); } catch (Exception ex) { _log.Error(ex); return(new ToDoListItemResponse { Message = ex.Message }); } }