public OperationResult Post(VenueResource newVenueResource) { var addVenueCommand = new AddVenueCommand( venueName: newVenueResource.Name, address: newVenueResource.Address, mapURN: newVenueResource.MapURN, contact: newVenueResource.Contact); commandProcessor.Send(addVenueCommand); var venue = new VenueTranslator().Translate( new VenueReader(_unitOfWorkFactory, false) .Get(addVenueCommand.Id) ); return new OperationResult.Created() { ResponseResource = venue, CreatedResourceUrl = new Uri(venue.Links[0].HRef) }; }
public OperationResult Put(Guid id, VenueResource venueResource) { var updateVenueCommand = new UpdateVenueCommand( id: id, venueName: venueResource.Name, address: venueResource.Address, mapURN: venueResource.MapURN, contact: venueResource.Contact, version: venueResource.Version); commandProcessor.Send(updateVenueCommand); var venue = new VenueTranslator().Translate( new VenueReader(_unitOfWorkFactory, false) .Get(updateVenueCommand.Id) ); return new OperationResult.OK { ResponseResource = venue }; }