Пример #1
0
        public HttpResponseMessage VenueItemWithQuantity(int id)
        {
            return(ErrorFactory.Handle(() =>
            {
                var userId = User?.Identity?.GetUserId();

                if (string.IsNullOrWhiteSpace(userId))
                {
                    throw new Exception();
                }

                using (var unitOfWork = new UnitOfWork())
                {
                    var venueItems = unitOfWork.VenueItems.GetVenueItemWithQuantityById(userId, id);

                    var outgoingVenueItems = OutgoingVenueItems.Parse(venueItems);

                    return JsonFactory.CreateJsonMessage(outgoingVenueItems, HttpStatusCode.OK, this.Request);
                }
            }, this.Request));
        }
Пример #2
0
        public HttpResponseMessage VenueItemByVenue(int venueId, bool includeHidden = false)
        {
            return(ErrorFactory.Handle(() =>
            {
                var userId = User?.Identity?.GetUserId();

                if (string.IsNullOrWhiteSpace(userId))
                {
                    throw new Exception();
                }

                using (var unitOfWork = new UnitOfWork())
                {
                    var venueItems = unitOfWork.VenueItems.GetVenueItemsByVenueId(userId, venueId, includeHidden).ToList();

                    var outgoingVenueItems = venueItems.Select(x => OutgoingVenueItems.Parse(x)).ToList();

                    return JsonFactory.CreateJsonMessage(outgoingVenueItems, HttpStatusCode.OK, this.Request);
                }
            }, this.Request));
        }
Пример #3
0
        public static OutgoingReservationItem Parse(ReserveItems x)
        {
            if (x == null)
            {
                return(null);
            }

            return(new OutgoingReservationItem
            {
                Id = x.Id,
                Quantity = x.Quantity,
                PricePreTax = x.PricePreTax,
                IgnoreQuantityRestrictions = x.IgnoreQuantityRestrictions,
                IsDeleted = x.IsDeleted,
                DeletedDate = x.DeletedDate,
                ItemId = x.ItemId,
                ReservationId = x.ReservationId,
                TaxRate = x.TaxRate,
                FinalPrice = x.FinalPrice,
                Item = OutgoingVenueItems.Parse(x.VenueItems)
            });
        }
Пример #4
0
        public HttpResponseMessage EditVenueItem(IncomingEditItem item)
        {
            return(ErrorFactory.Handle(() =>
            {
                var userId = User?.Identity?.GetUserId();

                if (string.IsNullOrWhiteSpace(userId))
                {
                    throw new Exception();
                }

                using (var unitOfWork = new UnitOfWork())
                {
                    var returnedItem = unitOfWork.VenueItems.EditItem(userId, item);

                    unitOfWork.Complete();

                    var outgoingItem = OutgoingVenueItems.Parse(returnedItem);

                    return JsonFactory.CreateJsonMessage(outgoingItem, HttpStatusCode.OK, this.Request);
                }
            }, this.Request));
        }