Ejemplo n.º 1
0
        public async Task <FastFlightResponse> Set(int airlineId, int fastFlightId, string username, ICollection <int> paidExtras, double loadWeight, string passportNum)
        {
            try
            {
                var temp = await repo.Set(airlineId, fastFlightId, username, paidExtras, loadWeight, passportNum);

                if (temp.Success)
                {
                    await unitOfWork.CompleteAsync();

                    var points = CalculatePoints(temp.Resource.Flight.Distance);

                    temp.Resource.User.Points += points;
                    await unitOfWork.CompleteAsync();
                }

                return(temp);
            }
            catch
            {
                return(new FastFlightResponse("Something went wrong. Please, try again later."));
            }
        }