예제 #1
0
        public async Task <ActionResult <TodoItemDTO> > PostAsync(TodoItemDTO item)
        {
            try
            {
                TodoItemDTO newItem = await _service.CreateAsync(item);

                return(CreatedAtAction(nameof(GetByIdAsync), new { id = newItem.Id }, newItem));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
 public async Task <int> Create([FromBody] TodoItemCreateFields fields) => await _itemService.CreateAsync(fields);
        public async Task <ActionResult <TodoItem> > Post(TodoItemCreate todoItemCreate)
        {
            var todoItemCreated = await _todoItemService.CreateAsync(todoItemCreate);

            return(Created("Get", todoItemCreated));
        }
예제 #4
0
 public async Task <IActionResult> CreateAsync(CreateTodoItemModel createTodoItemModel)
 {
     return(Ok(ApiResult <CreateTodoItemResponseModel> .Success(
                   await _todoItemService.CreateAsync(createTodoItemModel))));
 }