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)); }
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)); }
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) }); }
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)); }