public SubscriptionView GetSubscription(GetSubscriptionQuery query) { using (var views = new EntileViews()) { var client = (from c in views.ClientViews.Include("Subscriptions.ExtendedInformation") where c.ClientId == query.ClientId select c).SingleOrDefault(); if (client == null) return null; return client.Subscriptions.Where(s => s.SubscriptionId == query.SubscriptionId).SingleOrDefault(); } }
public SubscriptionResponse Get(Guid clientId, Guid subscriptionId) { var queries = new ClientQueries(); var query = new GetSubscriptionQuery() {ClientId = clientId, SubscriptionId = subscriptionId}; var subscription = queries.GetSubscription(query); if (subscription == null) throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); var response = new SubscriptionResponse() { ClientId = subscription.ClientId, SubscriptionId = subscription.SubscriptionId, NotificationKind = ((Server.Domain.NotificationKind) subscription.NotificationKind).ToString(), ParamUri = subscription.ParamUri, ExtendedInformation = subscription.ExtendedInformation.ToDictionary(ei => ei.Key, ei => ei.Value) }; _applier.Apply(Request, response); return response; }