public ActionResult AddApplicationSubscription(Subscription record, FormCollection form) { try { record.Type = "Application"; record.CreatedDate = DateTime.Now; record.State = "Active"; var application_ = form.GetValue("application_"); if ((application_ != null) && (application_.AttemptedValue != null)) { int applicationId = Int32.Parse(application_.AttemptedValue); SubscriptionItem item = new SubscriptionItem(); item.ApplicationId = applicationId; record.Items = new List<SubscriptionItem>(); record.Items.Add(item); } CcAddSubscriptionRequest request = new CcAddSubscriptionRequest(Settings.Credentials); request.Subscription = record; EndPoints.CcDashboardService.AddSubscription(request); return RedirectToAction("Subscriptions"); } catch (Exception e) { return ShowError(e); } }
private PersistenceStorage.SubscriptionItem TransformSubscriptionItem(SubscriptionItem item) { PersistenceStorage.SubscriptionItem item_ = new PersistenceStorage.SubscriptionItem(); item_.ID = item.Id; item_.SubscriptionID = item.SubscriptionId; item_.ApplicationID = item.ApplicationId; return item_; }
private static SubscriptionItem TransformSubscriptionItem(PersistenceStorage.SubscriptionItem item) { SubscriptionItem item_ = new SubscriptionItem(); item_.Id = item.ID; item_.SubscriptionId = item.SubscriptionID; item_.ApplicationId = item.ApplicationID; return item_; }