public string GetTripNames(List <VtUserSpots> spots, List <VtTrip> trips, VtPaymentCategory paymentCategory, bool withCar) { var tripString = ""; decimal tripPrice = 0; decimal paymentValue = VtConsts.GetPaymentValue(paymentCategory); try { var tripId = spots.FirstOrDefault(x => x.Spot.Day == VtDays.Tuesday).Spot.TripId; var trip = trips.FirstOrDefault(x => x.Id == tripId); tripString += "1. " + trip?.Name + "<br />"; tripPrice += trip?.Price ?? 0; tripId = spots.FirstOrDefault(x => x.Spot.Day == VtDays.Wednesday).Spot.TripId; trip = trips.FirstOrDefault(x => x.Id == tripId); tripString += "2. " + trip?.Name + "<br />"; tripPrice += trip?.Price ?? 0; tripId = spots.FirstOrDefault(x => x.Spot.Day == VtDays.Thursday).Spot.TripId; trip = trips.FirstOrDefault(x => x.Id == tripId); tripString += "3. " + trip?.Name + "<br />"; tripPrice += trip?.Price ?? 0; tripPrice += paymentValue; if (withCar) { tripPrice += 5; } return($"{tripString} Végösszeg: {tripPrice} lej"); } catch (Exception) { return("-Hiba-"); } }
public static decimal GetPaymentValue(VtPaymentCategory value) { return(PaymentCategoryValues.TryGetValue(value, out var result) ? result : -1); }