Beispiel #1
0
        public ToDoListItemResponse UpdateToDoListItem(ToDoListItemRequest item)
        {
            try
            {
                _log.Debug("Update list");
                _toDoListManager.UpdateList(Mapper.Map <ToDoListItem>(item));
                _log.Debug("Send result success update list");
                return(new ToDoListItemResponse {
                    StatusCode = 201, Message = "SUCCESS", Data = item
                });

                _log.Info("Updated list");
            }
            catch (ToDoListException ex)
            {
                _log.Error(ex);
                return(new ToDoListItemResponse {
                    Message = ex.Message
                });
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(new ToDoListItemResponse {
                    Message = ex.Message
                });
            }
        }
Beispiel #2
0
        public ToDoListItemResponse CreateToDoListItem(ToDoListItemRequest item)
        {
            try
            {
                _log.Debug("Create list");
                _toDoListManager.CreateList(Mapper.Map <ToDoListItem>(item));
                _log.Debug("Send result success create list");
                var list = _toDoListManager.GetListItems().LastOrDefault(u => u.Name == item.Name &&
                                                                         u.CreateDate == item.CreateDate);
                return(new ToDoListItemResponse {
                    StatusCode = 201, Message = "SUCCESS", Data = list
                });                                                                                     //item };

                _log.Info("Created list");
            }
            catch (ToDoListException ex)
            {
                _log.Error(ex);
                return(new ToDoListItemResponse {
                    Message = ex.Message
                });
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(new ToDoListItemResponse {
                    Message = ex.Message
                });
            }
        }