Ejemplo n.º 1
0
        public async Task BorrowGame(string name, string lastName, string nameGame, Platform platform, Genre genre)
        {
            #region AddGame
            var game = _serviceGame.Add(new GameDto
            {
                Name     = nameGame,
                Platform = platform,
                Genre    = genre
            }).Result;
            #endregion

            #region AddFriend
            var friend = _serviceFriend.Add(new FriendDto
            {
                Name     = name,
                LastName = lastName
            }).Result;
            #endregion

            var result = await _serviceBorrowedGame.BorrowGame(new BorrowDto
            {
                IdFriend = ((FriendDto)friend.Resource).Id,
                IdGame   = ((GameDto)game.Resource).Id
            });

            Assert.True(result.Success);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> BorrowGame(BorrowDto borrowDto)
        {
            try
            {
                var response = await _serviceBorrowedGame.BorrowGame(borrowDto);

                return(Ok(response));
            }
            catch (Exception)
            {
                return(BadRequest(new GameResponse(NotificacaoDto.ErroPadrao)));
            }
        }