Exemple #1
0
        public void CreateToDoList(TodoListModel todoList)
        {
            var listDto = Mapper.Map<TodoList>(todoList);
            dbContext.TodoLists.Add(listDto);
            dbContext.SaveChanges();

            //remap back to pick up id's etc..
            Mapper.Map(listDto, todoList);
        }
 public ActionResult Add()
 {
     var todoListModel = new TodoListModel();
     todoListModel.Name = "shopping list";
     todoListModel.TodoListItems.Add(new TodoListItemModel()
                             {
                                 Name = "chips",
                                 Content = "mmm chips"
                             });
     ListService.CreateToDoList(todoListModel);
     return View();
 }