/// <summary> /// Provide details about a particular subscription i.e. description etc. /// </summary> /// <param name="subscriptionName">Name of the subscription to search.</param> /// <returns>Returns the subscripton details (name, description).</returns> public SubscriptionInfoDataModel SelectBySubscription(string subscriptionName) { try { SubscriptionInfoDataModel sidm = this.serviceContext.SubscriptionsInfoTable.Where(s => (s.SubscriptionName == subscriptionName)).FirstOrDefault(); return(sidm); } catch (DataServiceQueryException) { return(null); } }
/// <summary> /// Delete a subscription from the system. Higher level should clean up subscriptions in the system, i.e. remove devices from the subscription /// </summary> /// <param name="item">Subscription info record to be deleted.</param> public void Delete(SubscriptionInfoDataModel item) { this.serviceContext.DeleteObject(item); this.serviceContext.SaveChanges(); }
// CRUD operations below /// <summary> /// Used to create / insert a new subscription. /// </summary> /// <param name="newItem">Subscription info record to be inserted.</param> public void Insert(SubscriptionInfoDataModel newItem) { this.serviceContext.AddObject(MessageServiceContext.SubscriptionsInfoTableName, newItem); this.serviceContext.SaveChanges(); }
/// <summary> /// Subscription info record to be deleted. /// </summary> /// <param name="updatedItem">Subscription info record to be updated.</param> public void Update(SubscriptionInfoDataModel updatedItem) { throw new NotImplementedException(); }