Ejemplo n.º 1
0
        public object GetBoard(int id)
        {
            var map = mapper.CreateMapper();

            if (id != 0)
            {
                BoardDTO       board   = BoardService.Get(id);
                BoardViewModel myboard = map.Map <BoardViewModel>(board);

                return(JsonConvert.SerializeObject(myboard, Formatting.None, new JsonSerializerSettings()
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                }));
            }
            else
            {
                IEnumerable <BoardDTO>       board   = BoardService.GetAll(User.Identity.GetUserId());
                IEnumerable <BoardViewModel> myboard = map.Map <IEnumerable <BoardViewModel> >(board);

                return(JsonConvert.SerializeObject(myboard.FirstOrDefault(), Formatting.None, new JsonSerializerSettings()
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                }));
            }
        }
Ejemplo n.º 2
0
        public void GetAll_should_return_all_boards()
        {
            var data    = TestUtils.GetBoardData();
            var service = new BoardService(TestUtils.InitBoardMoqContext(data).Object);
            var boards  = service.GetAll();

            Assert.True(3 == boards.Count);
        }
Ejemplo n.º 3
0
 public ActionResult <List <Board> > GetAll()
 {
     return(Ok(_boardService.GetAll()));
 }