示例#1
0
        public Response Post(ToDoTask toDoTask)
        {
            _toDoTaskService.Create(toDoTask);

            return(new Response {
                Body = "success"
            });
        }
        // POST: api/ToDoTasks/PostToDoTask
        public IHttpActionResult PostToDoTask(ToDoTaskDTO toDoTaskDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            toDoTaskDTO = _toDoTaskService.Create(toDoTaskDTO);

            return(CreatedAtRoute("DefaultApi", new { id = toDoTaskDTO.Id }, toDoTaskDTO));
        }