public ActionResult Order(int? id) { OrderContext model = new OrderContext(); int currentUserId = WebSecurity.CurrentUserId; List<GuestClaim> linkedClaims = GuestProvider.GetLinkedClaims(UrlLanguage.CurrentLanguage, currentUserId); int? detailedId = null; if (id.HasValue) { if (linkedClaims.FirstOrDefault((GuestClaim m) => m.claim == id.Value) != null) { detailedId = new int?(id.Value); } } if (!(detailedId.HasValue || (linkedClaims.Count <= 0))) { detailedId = new int?(linkedClaims[0].claim); } if (detailedId.HasValue) { ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, detailedId.Value); if ((reservationState != null) && reservationState.claimId.HasValue) { model.Claim = reservationState; model.ExcursionTransfers = GuestProvider.GetExcursionTransferByClaim(UrlLanguage.CurrentLanguage, reservationState.claimId.Value); } } model.ClaimsNotFound = linkedClaims.Count == 0; model.ShowOtherClaims = true; model.OtherClaims = ( from m in linkedClaims //удалить детальн // where m.claim != detailedId select m).ToList<GuestClaim>(); // model.OtherClaims = linkedClaims.Where<GuestClaim>(new Func<GuestClaim, bool>(class2, (IntPtr) this.<Order>b__2)).ToList<GuestClaim>(); return base.View(model); }
public ActionResult Order([Bind(Prefix="OrderFindForm")] OrderModel model) { OrderContext context = new OrderContext { ShowOrderFindForm = true }; if (base.ModelState.IsValid) { List<GuestClaim> list = GuestProvider.FindGuestClaims(UrlLanguage.CurrentLanguage, 0, model.ClaimName, new int?(Convert.ToInt32(model.Claim)), null); if ((list != null) && (list.Count > 0)) { ReservationState reservationState = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, list[0].claim); if ((reservationState != null) && reservationState.claimId.HasValue) { context.Claim = reservationState; context.ExcursionTransfers = GuestProvider.GetExcursionTransferByClaim(UrlLanguage.CurrentLanguage, reservationState.claimId.Value); context.ShowOrderFindForm = false; } } } context.OrderFindNotFound = context.Claim == null; return base.View(context); }