Esempio n. 1
0
        public async Task <ActionResult <Board> > CreateBoard(Board board)
        {
            var userId = httpContextAccessor.HttpContext.User.Identity.Name;
            var user   = userService.GetById(userId);

            Lane[] lanes =
            {
                new Lane {
                    Title = "Wat ging goed?"
                },
                new Lane {
                    Title = "Wat kon beter?"
                },
                new Lane {
                    Title = "Te ondernemen acties"
                }
            };
            board.Owner = new BoardUser(user.Id, user.Username);
            boardService.Create(board);
            foreach (var lane in lanes)
            {
                var createdLane = await laneService.Create(lane);

                await boardService.AddLane(board.Id, createdLane);
            }

            return(CreatedAtRoute("GetBoard", new { id = board.Id }, board));
        }