Пример #1
0
        public SaveResult <TodoList> SaveTodoList(TodoList todoList)
        {
            using (TodoContext db = new TodoContext())
            {
                TodoListDTO dbModel = mapper.ContractToModel(todoList);

                db.AddOrUpdate(dbModel);
                db.SaveChanges();

                TodoList savedTodoItem = mapper.ModelToContract(dbModel);

                SaveResult <TodoList> saveResult = new SaveResult <TodoList>(savedTodoItem);
                return(saveResult);
            }
        }