Exemple #1
0
        public IActionResult GetAll()
        {
            var friendsList = _friendApp.GetAll();

            if (friendsList == null)
            {
                return(NotFound("Not found"));
            }
            return(Ok(friendsList));
        }
Exemple #2
0
        public async Task <ActionResult> Index()
        {
            var friends = (await _friendAppService.GetAll(new PagedResultRequestDto {
                MaxResultCount = int.MaxValue
            })).Items;                                                                                                         // Paging not implemented yet

            var model = new FriendListViewModel
            {
                Friends = friends,
            };

            return(View(model));
        }
        public async Task <ActionResult> Index()
        {
            var friends             = (await _friendAppService.GetAll()).Items;
            var games               = (await _gameAppService.GetAll()).Items;
            var gamesBorrowed       = games.Where(x => x.IdFriend != null && x.IdFriend != 0).ToList();
            var gamesAvailableCount = games.Where(x => x.IdFriend == null || x.IdFriend == 0).Count();


            var friendsGames = friends.Where(x => x.Games.Any());

            Dictionary <string, string> dictionarygamesBorrew = new Dictionary <string, string>();

            foreach (var gameBorrowed in gamesBorrowed)
            {
                dictionarygamesBorrew.Add(friends.Where(u => u.Id == gameBorrowed.IdFriend).FirstOrDefault().Name, gameBorrowed.Name);
            }

            return(View(new HomeDetails()
            {
                Friends = friends.Count, GamesAvailable = gamesAvailableCount, GamesBorrowed = dictionarygamesBorrew
            }));
        }
 public IEnumerable <Friend> Get()
 {
     return(_friendAppService.GetAll());
 }
Exemple #5
0
 public async Task<IActionResult> ReadAll([FromQuery] int offset, int limit)
 {
     return _actionResultConverter.Convert(await _friendService.GetAll(offset, limit));
 }
Exemple #6
0
 // GET: Friends
 public ActionResult Index()
 {
     return(View(_friendAppService.GetAll()));
 }