Exemple #1
0
        public HttpResponseMessage EditVenue(IncomingEditVenue addVenue)
        {
            return(ErrorFactory.Handle(() =>
            {
                var userId = User?.Identity?.GetUserId();

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

                using (var unitOfWork = new UnitOfWork())
                {
                    var editVenue = unitOfWork.Venues.EditVenue(userId, addVenue);

                    unitOfWork.Complete();

                    try
                    {
                        editVenue = unitOfWork.Venues.GetVenueById(userId, editVenue.Id);
                    }
                    catch (Exception)
                    {
                    }

                    var outgoingVenue = OutgoingVenue.Parse(editVenue);

                    return JsonFactory.CreateJsonMessage(outgoingVenue, HttpStatusCode.OK, this.Request);
                }
            }, this.Request));
        }
Exemple #2
0
        public HttpResponseMessage Venue(int id)
        {
            return(ErrorFactory.Handle(() =>
            {
                var userId = User?.Identity?.GetUserId();

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

                using (var unitOfWork = new UnitOfWork())
                {
                    var venue = unitOfWork.Venues.GetVenueById(userId, id);

                    var outgoingVenues = OutgoingVenue.Parse(venue);

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