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)); }
public async Task <IActionResult> CreateAsync(CreateTodoItemModel createTodoItemModel) { return(Ok(ApiResult <CreateTodoItemResponseModel> .Success( await _todoItemService.CreateAsync(createTodoItemModel)))); }