public static SubscriptionWebServiceModel FromDataModel(Subscription subscription, AccountWebServiceModel account) { if (subscription == null) return null; return new SubscriptionWebServiceModel { GUID = subscription.GUID, Account = account, Created = subscription.Created, End = subscription.End, Lines = subscription.Lines.Select(LineWebServiceModel.FromDataModel).ToList(), Start = subscription.Start }; }
/// <summary> /// Renew an existing subscription /// </summary> /// <param name="subscription">The subscription to renew</param> /// <param name="startDate">The start date from which to renew the subscription</param> /// <returns></returns> public SubscriptionWebServiceModel RenewSubscriptionWithStartDate(SubscriptionWebServiceModel subscription, DateTime startDate) { var dmSubscription = new Subscription { GUID = subscription.GUID }; subscription = null; try { subscription = SubscriptionWebServiceModel.FromDataModel(subscriptionService.RenewSubscription(dmSubscription, startDate)); } catch (Exception) { } return subscription; }
public static SubscriptionWebServiceModel FromDataModel(Subscription subscription) { return FromDataModel(subscription, subscription == null ? null : AccountWebServiceModel.FromModelObject(subscription.Account)); }