public async Task <ActionResult <FriendRequest> > DeleteFriendRequest(MAANPP20ContextFlight _context, string id)
        {
            if (id == null)
            {
                return(null);
            }
            string myId  = id.Split('|')[0];
            string hisId = id.Split('|')[1];
            // vraca nam zahtev
            var friendRequest = await _context.FriendRequests
                                .FirstOrDefaultAsync(i => i.hisId == hisId && i.myId == myId);

            if (friendRequest == null)
            {
                return(null);
            }

            // vraca nam cekanje
            var waitingFriendRequest = await _context.FriendRequests
                                       .FirstOrDefaultAsync(i => i.hisId == myId && i.myId == hisId);

            if (waitingFriendRequest == null)
            {
                return(null);
            }


            _context.FriendRequests.Remove(friendRequest);
            _context.FriendRequests.Remove(waitingFriendRequest);
            await _context.SaveChangesAsync();

            return(friendRequest);
        }
        public async Task <ActionResult <IEnumerable <User> > > GetFriendlist(MAANPP20ContextFlight _context, string email)
        {
            var user = await _context.Users.Where(x => x.deleted == false)
                       .Include(friends => friends.friends)
                       .Include(friends => friends.friends)
                       .ThenInclude(messeges => messeges.messages)
                       .FirstOrDefaultAsync(i => i.Email == email);

            var friends = new List <User>();

            foreach (var friend in user.friends)
            {
                if (friend.hisId != null)
                {
                    if (friend.deleted == false)
                    {
                        var tempUser = await _context.Users
                                       .FirstOrDefaultAsync(i => i.Id == friend.hisId);

                        friends.Add(tempUser);
                    }
                }
            }

            return(friends);
        }
        public async Task <ActionResult <User> > GetUser(MAANPP20ContextFlight _context, string email)
        {
            var user = await _context.Users.Where(x => x.deleted == false)
                       .Include(address => address.address)
                       //.Include(friends => friends.friends)
                       //    .ThenInclude()
                       .FirstOrDefaultAsync(i => i.Email == email);

            //var friendRequests = await _context.FriendRequests
            //    .Where(x => x.myId == user.Id)
            //    .Include(user => user.user)
            //    .ToListAsync();

            if (user == null)
            {
                return(null);
            }
            else if (user.deleted == true)
            {
                return(null);
            }

            //if (friendRequests == null) return NotFound();
            //else user.friendRequests = friendRequests;

            return(user);
        }
        public async Task <ActionResult <Flight> > GetFlight(MAANPP20ContextFlight _context, int id)
        {
            Flight flight = null;

            try
            {
                flight = await _context.Flights.Where(x => x.deleted == false)
                         .Include(from => from.from)
                         .Include(to => to.to)
                         .Include(presedanje => presedanje.presedanje)
                         .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                         .Include(aeroplane => aeroplane.aeroplane)
                         .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                         .Include(luggage => luggage.luggage)
                         .Include(ocene => ocene.ocene)
                         .FirstOrDefaultAsync(i => i.id == id);

                if (flight == null)
                {
                    return(null);
                }
                if (flight.deleted == true)
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(flight);
        }
        public async Task <Flight> UpdateFlight(MAANPP20ContextFlight _context, Flight flight)
        {
            foreach (var seat in flight.allSeatsForThisFlight)
            {
                _context.Entry(seat).State = EntityState.Modified;
            }
            _context.Entry(flight).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightExists(_context, flight.id))
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }

            return(flight);
        }
        public async Task <ActionResult <Flight> > AddFlight(MAANPP20ContextFlight _context, Flight flight)
        {
            var flightCompany = await _context.FlightCompanies
                                .Include(address => address.address)
                                .Include(destinations => destinations.destinations)
                                .Include(flights => flights.flights)
                                .Include(ocene => ocene.ocene)
                                .FirstOrDefaultAsync(i => i.id == flight.idCompany);

            if (flightCompany == null)
            {
                return(null);
            }

            // posto vec postoje sa primarnim kljucevima
            flight.addressFromId = flight.from.id;
            flight.addressToId   = flight.to.id;
            flight.aeroplaneId   = flight.aeroplane.id;

            //dodaj mu destinaciju i sacuvaj izmene u kompaniji
            flightCompany.flights.Add(flight);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                throw;
            }

            return(flight);
        }
        public async Task <ActionResult <IEnumerable <Flight> > > GetFlights(MAANPP20ContextFlight _context)
        {
            var flights = await _context.Flights.Where(x => x.deleted == false)
                          .Include(from => from.from)
                          .Include(to => to.to)
                          .Include(presedanje => presedanje.presedanje)
                          .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                          .Include(aeroplane => aeroplane.aeroplane)
                          .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                          .Include(luggage => luggage.luggage)
                          .Include(ocene => ocene.ocene)
                          .ToListAsync();

            var retFlights = new List <Flight>();

            foreach (var flight in flights)
            {
                if (flight.deleted == false)
                {
                    retFlights.Add(flight);
                }
            }

            return(retFlights);
        }
Beispiel #8
0
        public async Task <FlightCompany> UpdateFlightCompany(MAANPP20ContextFlight _context, FlightCompany flightCompany)
        {
            if (flightCompany.admin != null)
            {
                flightCompany.admin.serviceId             = flightCompany.id;
                _context.Entry(flightCompany.admin).State = EntityState.Modified;
            }

            _context.Entry(flightCompany.address).State = EntityState.Modified;
            _context.Entry(flightCompany).State         = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightCompanyExists(_context, flightCompany.id))
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }

            return(flightCompany);
        }
Beispiel #9
0
        public async Task <ActionResult <FlightCompany> > AddFlightCompany(MAANPP20ContextFlight _context, FlightCompany flightCompany)
        {
            _context.FlightCompanies.Add(flightCompany);

            await _context.SaveChangesAsync();

            return(flightCompany);
        }
        public async Task <ActionResult <Aeroplane> > AddPlane(MAANPP20ContextFlight _context, Aeroplane aeroplane)
        {
            _context.Aeroplanes.Add(aeroplane);

            await _context.SaveChangesAsync();

            return(aeroplane);
        }
        public async Task <Friend> DeleteFriend(MAANPP20ContextFlight _context, string id)
        {
            if (id == null)
            {
                return(null);
            }

            string myId  = id.Split('|')[0];
            string hisId = id.Split('|')[1];

            var friend = await _context.Friends.Where(x => x.deleted == false)
                         .Include(messages => messages.messages)
                         .FirstOrDefaultAsync(i => i.myId == myId && i.hisId == hisId);

            if (friend == null)
            {
                return(null);
            }
            if (friend.deleted == true)
            {
                return(null);
            }

            foreach (var message in friend.messages)
            {
                message.deleted = true;
                _context.Entry(message).State = EntityState.Modified;
            }

            friend.deleted = true;
            _context.Entry(friend).State = EntityState.Modified;

            var friend1 = await _context.Friends.Where(x => x.deleted == false)
                          .Include(messages => messages.messages)
                          .FirstOrDefaultAsync(i => i.myId == hisId && i.hisId == myId);

            if (friend1 == null)
            {
                return(null);
            }
            if (friend1.deleted == true)
            {
                return(null);
            }

            foreach (var message in friend1.messages)
            {
                message.deleted = true;
                _context.Entry(message).State = EntityState.Modified;
            }

            friend1.deleted = true;
            _context.Entry(friend1).State = EntityState.Modified;

            await _context.SaveChangesAsync();

            return(friend);
        }
Beispiel #12
0
        public async Task <FlightReservation> UpdateFlightReservation(MAANPP20ContextFlight _context, FlightReservation flightReservation)
        {
            Flight flight = await _context.Flights.Where(x => x.deleted == false)
                            .Include(ocene => ocene.ocene)
                            .FirstOrDefaultAsync(id => id.id == flightReservation.flightId);

            if (flight == null)
            {
                return(null);
            }
            if (flightReservation.ocenaLeta > 0)
            {
                DoubleForICollection doubleForICollection = new DoubleForICollection();
                doubleForICollection.DoubleValue = flightReservation.ocenaLeta;
                flight.ocene.Add(doubleForICollection);
                _context.Entry(flight).State = EntityState.Modified;
            }

            if (flightReservation.ocenaKompanije > 0)
            {
                FlightCompany flightCompany = await _context.FlightCompanies.Where(x => x.deleted == false)
                                              .Include(ocene => ocene.ocene)
                                              .FirstOrDefaultAsync(id => id.id == flight.idCompany);

                if (flightCompany == null)
                {
                    return(null);
                }
                DoubleForICollection doubleForICollection = new DoubleForICollection();
                doubleForICollection.DoubleValue = flightReservation.ocenaKompanije;
                flightCompany.ocene.Add(doubleForICollection);
                _context.Entry(flightCompany).State = EntityState.Modified;
            }

            _context.Entry(flightReservation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightReservationExists(_context, flightReservation.id))
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }

            return(flightReservation);
        }
Beispiel #13
0
        private async Task <bool> Check(MAANPP20ContextFlight _context, string invitationString)
        {
            FriendForFlight friendForFlight = await _context.FriendForFlights
                                              .FirstOrDefaultAsync(x => x.invitationString == invitationString);

            if (friendForFlight == null)
            {
                return(true);
            }
            return(false);
        }
        public async Task <ActionResult <Aeroplane> > GetAeroplane(MAANPP20ContextFlight _context, int id)
        {
            var aeroplane = await _context.Aeroplanes
                            .Where(x => x.deleted == false)
                            .FirstOrDefaultAsync(i => i.id == id);

            if (aeroplane == null)
            {
                return(null);
            }
            return(aeroplane);
        }
Beispiel #15
0
        private string RandomString(MAANPP20ContextFlight _context)
        {
            Random       random = new Random();
            const string chars  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string       str    = new string(Enumerable.Repeat(chars, 10)
                                             .Select(s => s[random.Next(s.Length)]).ToArray());

            if (!this.Check(_context, str).Result)
            {
                RandomString(_context);
            }
            return(str);
        }
        public async Task <ActionResult <FriendRequest> > AddFriendRequest(MAANPP20ContextFlight _context, FriendRequest friendRequest)
        {
            if (friendRequest.myId == friendRequest.hisId)
            {
                return(null);
            }

            // ne moze da se posalje 2 puta isti zahtev
            if (FriendRequestExists(_context, friendRequest.myId, friendRequest.hisId))
            {
                return(null);
            }

            var user = await _context.Users
                       .Include(address => address.address)
                       .Include(friends => friends.friends)
                       .Include(friendRequests => friendRequests.friendRequests)
                       .FirstOrDefaultAsync(i => i.Id == friendRequest.myId);

            if (user == null)
            {
                return(null);
            }

            user.friendRequests.Add(friendRequest);
            // ja sam poslao zahtev
            _context.FriendRequests.Add(friendRequest);

            await _context.SaveChangesAsync();

            var he = await _context.Users
                     .Include(address => address.address)
                     .Include(friends => friends.friends)
                     .Include(friendRequests => friendRequests.friendRequests)
                     .FirstOrDefaultAsync(i => i.Id == friendRequest.hisId);

            var hisFriendRequest = new FriendRequest();

            hisFriendRequest.myId      = friendRequest.hisId;
            hisFriendRequest.hisId     = friendRequest.myId;
            hisFriendRequest.isRequest = true;

            he.friendRequests.Add(hisFriendRequest);

            // on je primio zahtev
            _context.FriendRequests.Add(hisFriendRequest);

            await _context.SaveChangesAsync();

            return(friendRequest);
        }
        public async Task <ActionResult <IEnumerable <Flight> > > GetFlights(MAANPP20ContextFlight _context, SearchFlight search)
        {
            List <Flight> flights;

            if (search.selectType == 1)
            {
                return(flights = await _context.Flights
                                 .Where(x => x.deleted == false && x.company == search.inputSearch)
                                 .Include(from => from.from)
                                 .Include(to => to.to)
                                 .Include(presedanje => presedanje.presedanje)
                                 .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                                 .Include(aeroplane => aeroplane.aeroplane)
                                 .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                                 .Include(luggage => luggage.luggage)
                                 .Include(ocene => ocene.ocene)
                                 .ToListAsync());
            }
            else if (search.selectType == 2)
            {
                return(flights = await _context.Flights
                                 .Where(x => x.deleted == false && x.from.city == search.inputSearch)
                                 .Include(from => from.from)
                                 .Include(to => to.to)
                                 .Include(presedanje => presedanje.presedanje)
                                 .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                                 .Include(aeroplane => aeroplane.aeroplane)
                                 .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                                 .Include(luggage => luggage.luggage)
                                 .Include(ocene => ocene.ocene)
                                 .ToListAsync());
            }
            else if (search.selectType == 3)
            {
                return(flights = await _context.Flights
                                 .Where(x => x.deleted == false && x.to.city == search.inputSearch)
                                 .Include(from => from.from)
                                 .Include(to => to.to)
                                 .Include(presedanje => presedanje.presedanje)
                                 .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                                 .Include(aeroplane => aeroplane.aeroplane)
                                 .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                                 .Include(luggage => luggage.luggage)
                                 .Include(ocene => ocene.ocene)
                                 .ToListAsync());
            }


            return(null);
        }
Beispiel #18
0
        public async Task <ActionResult <FlightCompany> > DeleteFlightCompany(MAANPP20ContextFlight _context, int id)
        {
            var flightCompany = await _context.FlightCompanies
                                .Include(address => address.address)
                                .Include(destinations => destinations.destinations)
                                .ThenInclude(startAddr => startAddr.startAddress)
                                .Include(destinations => destinations.destinations)
                                .ThenInclude(endAddr => endAddr.endAddress)
                                .Include(flights => flights.flights)
                                .ThenInclude(allSeats => allSeats.allSeatsForThisFlight)
                                .Include(admin => admin.admin)
                                .Include(ocene => ocene.ocene)
                                .FirstOrDefaultAsync(i => i.id == id);

            if (flightCompany == null)
            {
                return(null);
            }
            else if (flightCompany.deleted == true)
            {
                return(null);
            }

            flightCompany.admin.serviceId             = 0;
            _context.Entry(flightCompany.admin).State = EntityState.Modified;

            flightCompany.deleted         = true;
            flightCompany.address.deleted = true;
            foreach (var destination in flightCompany.destinations)
            {
                destination.deleted = true;
                destination.startAddress.deleted = true;
                destination.endAddress.deleted   = true;
            }
            foreach (var flight in flightCompany.flights)
            {
                flight.deleted = true;
                foreach (var seat in flight.allSeatsForThisFlight)
                {
                    seat.deleted = true;
                }
            }
            _context.Entry(flightCompany).State = EntityState.Modified;

            //_context.FlightCompanies.Remove(flightCompany);
            await _context.SaveChangesAsync();

            return(flightCompany);
        }
Beispiel #19
0
        public async Task <ActionResult <FlightCompany> > GetFlightCompany(MAANPP20ContextFlight _context, int id)
        {
            var flightCompany = await _context.FlightCompanies.Where(x => x.deleted == false)
                                .Include(admin => admin.admin)
                                .Include(address => address.address)
                                .Include(destinations => destinations.destinations)
                                .ThenInclude(startAddr => startAddr.startAddress)
                                .Include(destinations => destinations.destinations)
                                .ThenInclude(endAddr => endAddr.endAddress)
                                .Include(flights => flights.flights)
                                //.ThenInclude(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                                .Include(ocene => ocene.ocene)
                                .FirstOrDefaultAsync(i => i.id == id);

            if (flightCompany == null)
            {
                return(null);
            }
            else if (flightCompany.deleted == true)
            {
                return(null);
            }

            var flightDestinations = new List <FlightDestination>();

            foreach (var flightDestination in flightCompany.destinations)
            {
                if (flightDestination.deleted == false)
                {
                    flightDestinations.Add(flightDestination);
                }
            }
            flightCompany.destinations = flightDestinations;

            var flights = new List <Flight>();

            foreach (var flight in flightCompany.flights)
            {
                if (flight.deleted == false)
                {
                    flights.Add(flight);
                }
            }
            flightCompany.flights = flights;

            // TO DO : isto i za ocene

            return(flightCompany);
        }
Beispiel #20
0
        public async Task <ActionResult <int> > GetUsersFlightCompanyId(MAANPP20ContextFlight _context, string id)
        {
            var flightCompany = await _context.FlightCompanies.Where(x => x.deleted == false)
                                .Include(admin => admin.admin)
                                .FirstOrDefaultAsync(i => i.idAdmin == id);

            if (flightCompany == null)
            {
                return(0);
            }
            else if (flightCompany.deleted == true)
            {
                return(0);
            }
            return(flightCompany.id);
        }
        public async Task <ActionResult <Address> > GetFlightCompanyAddress(MAANPP20ContextFlight _context, int id)
        {
            var flightCompany = await _context.FlightCompanies
                                .Include(address => address.address)
                                .FirstOrDefaultAsync(i => i.id == id);

            if (flightCompany == null)
            {
                return(null);
            }
            else if (flightCompany.deleted == true)
            {
                return(null);
            }

            return(flightCompany.address);
        }
Beispiel #22
0
        public async Task <ActionResult <FlightDestination> > GetFlightDestination(MAANPP20ContextFlight _context, int id)
        {
            var flightDestinaion = await _context.FlightDestinations
                                   .Include(address1 => address1.startAddress)
                                   .Include(address2 => address2.endAddress)
                                   .FirstOrDefaultAsync(i => i.id == id);

            if (flightDestinaion == null)
            {
                return(null);
            }
            else if (flightDestinaion.deleted == true)
            {
                return(null);
            }
            return(flightDestinaion);
        }
Beispiel #23
0
        public async Task <FriendForFlight> AcceptFriendForFlight(MAANPP20ContextFlight _context, StringForICollection invitationString)
        {
            var friendForFlight = await _context.FriendForFlights
                                  .Where(x => x.deleted == false)
                                  .FirstOrDefaultAsync(x => x.invitationString == invitationString.PlainString);

            if (friendForFlight == null)
            {
                return(null);
            }

            friendForFlight.acceptedCall          = true;
            _context.Entry(friendForFlight).State = EntityState.Modified;

            _context.SaveChanges();

            return(friendForFlight);
        }
Beispiel #24
0
        public async Task <ActionResult <IEnumerable <Message> > > GetUser(MAANPP20ContextFlight _context, string id)
        {
            if (id == null)
            {
                return(null);
            }
            string myId  = id.Split('|')[0];
            string hisId = id.Split('|')[1];

            var messages = await _context.Messages
                           .Where(x => x.deleted == false && x.myId == myId && x.hisId == hisId)
                           .ToListAsync();

            if (messages == null)
            {
                return(null);
            }

            return(messages);
        }
        public async Task <ActionResult <Flight> > DeleteFlight(MAANPP20ContextFlight _context, int id)
        {
            var flight = await _context.Flights
                         .Include(presedanje => presedanje.presedanje)
                         .ThenInclude(gradoviPresedanja => gradoviPresedanja.gradoviPresedanja)
                         .Include(luggage => luggage.luggage)
                         .Include(ocene => ocene.ocene)
                         .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                         .FirstOrDefaultAsync(i => i.id == id);

            if (flight == null)
            {
                return(null);
            }
            else if (flight.deleted == true)
            {
                return(null);
            }

            flight.deleted = true;
            foreach (var seat in flight.allSeatsForThisFlight)
            {
                seat.deleted = true;
            }

            flight.presedanje.deleted = true;
            foreach (var gradPresedanja in flight.presedanje.gradoviPresedanja)
            {
                gradPresedanja.deleted = true;
            }

            flight.luggage.deleted = true;

            // TO DO: brisanje ocena

            _context.Entry(flight).State = EntityState.Modified;
            //_context.Flights.Remove(flight);
            await _context.SaveChangesAsync();

            return(flight);
        }
Beispiel #26
0
        public async Task <FriendForFlight> DeclineFriendForFlight(MAANPP20ContextFlight _context, string invitationString)
        {
            var friendForFlight = await _context.FriendForFlights
                                  .Where(x => x.deleted == false)
                                  .FirstOrDefaultAsync(x => x.invitationString == invitationString);

            if (friendForFlight == null)
            {
                return(null);
            }
            if (friendForFlight.deleted == true)
            {
                return(null);
            }

            var seat = await _context.AvioSedista
                       .Where(x => x.reserved == true)
                       .FirstOrDefaultAsync(x => x.id == friendForFlight.seatId);

            if (seat == null)
            {
                return(null);
            }
            seat.reserved = false;
            _context.Entry(seat).State = EntityState.Modified;

            friendForFlight.deleted = true;
            _context.Entry(friendForFlight).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                throw;
            }

            return(friendForFlight);
        }
        public async Task <Aeroplane> UpdatePlane(MAANPP20ContextFlight _context, Aeroplane aeroplane)
        {
            _context.Entry(aeroplane).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlaneExists(_context, aeroplane.id))
                {
                    return(null);
                }
                else
                {
                    throw;
                }
            }

            return(aeroplane);
        }
        public async Task <ActionResult <Flight> > GetFlightSeats(MAANPP20ContextFlight _context, int id)
        {
            Flight flight = null;

            try
            {
                flight = await _context.Flights
                         .Include(allSeatsForThisFlight => allSeatsForThisFlight.allSeatsForThisFlight)
                         .FirstOrDefaultAsync(i => i.id == id);

                if (flight == null)
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(flight);
        }
Beispiel #29
0
        public async Task <ActionResult <FlightDestination> > AddFlightCompany(MAANPP20ContextFlight _context, FlightDestination flightDestination)
        {
            var flightCompany = await _context.FlightCompanies
                                .Include(address => address.address)
                                .Include(destinations => destinations.destinations)
                                .Include(flights => flights.flights)
                                .Include(ocene => ocene.ocene)
                                .FirstOrDefaultAsync(i => i.id == flightDestination.CompanyID);

            if (flightCompany == null)
            {
                return(null);
            }

            //dodaj mu destinaciju i sacuvaj izmene u kompaniji
            flightCompany.destinations.Add(flightDestination);

            _context.FlightDestinations.Add(flightDestination);

            await _context.SaveChangesAsync();

            return(flightDestination);
        }
        public async Task <ActionResult <IEnumerable <User> > > GetWaitingUsers(MAANPP20ContextFlight _context, string email)
        {
            var user = await _context.Users.Where(x => x.deleted == false)
                       .FirstOrDefaultAsync(i => i.Email == email);

            var friendRequests = await _context.FriendRequests
                                 .Where(x => x.myId == user.Id && x.isRequest == false)
                                 .ToListAsync();

            var users = new List <User>();

            foreach (var friendRequest in friendRequests)
            {
                if (friendRequest.myId != null && friendRequest.hisId != null && friendRequest.isRequest == false)
                {
                    var tempUser = await _context.Users
                                   .FirstOrDefaultAsync(i => i.Id == friendRequest.hisId);

                    users.Add(tempUser);
                }
            }

            return(users);
        }