예제 #1
0
        public HttpResponseMessage Put(int id, EditTodoListModel model)
        {
            if (ModelState.IsValid)
            {
                // Bind the model to a TodoList object
                var mapper = new EditTodoListMapper();
                mapper.Configure();

                // Map the model to the todolist result
                var todoList = mapper.Map(model);

                // Create the todoList
                var editTodoListHandler = new EditTodoListHandler();
                editTodoListHandler.Handle(id, todoList);

                var response = Request.CreateResponse <TodoList>(HttpStatusCode.OK, todoList);
                return(response);
            }

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ModelState));
        }
예제 #2
0
 public TodoList Map(EditTodoListModel model)
 {
     return(Mapper.Map <EditTodoListModel, TodoList>(model));
 }