public async Task <TodoFolder> Create(TodoFolderDTO itemDTO, string userId) { TodoFolder item = new TodoFolder() { Description = itemDTO.Description }; item.user = await _userSearcher.GetBy(x => x.Id == userId); return(await _folderSearcher.Insert(item)); }
public async Task <ActionResult> CreateAsync(TodoFolderDTO item) { if (!string.IsNullOrWhiteSpace(item.Description)) { try { await _todoFoldersService.Create(item, @User.FindFirst("userId").Value); return(Ok()); } catch (System.Exception) { throw; } } else { return(BadRequest("Description cannot be empty")); } }