public ActionResult Renew() { RenewSubscriptionList renewSub = new RenewSubscriptionList(); renewSub.SubscriptionList = CentralizedSubscriptionLogic.GetExpireSubscription(); return(View(renewSub)); }
public SubscriptionList RenewSubscription(RenewSubscriptionList subList, string userId) { var user = UserManager.FindByIdAsync(userId).Result; List <Subscription> subscriptionListWithLicense = new List <Subscription>(); var subIdList = subList.SubscriptionList.Select(s => s.Id).ToList(); var userSubList = Work.UserSubscriptionRepository.GetData(u => u.UserId == userId && subIdList.Contains(u.SubscriptionTypeId)).ToList(); foreach (var sub in userSubList) { sub.RenewalDate = subList.RenewalDate; sub.ExpireDate = sub.ExpireDate.AddDays(sub.Subtype.ActiveDays); Work.UserSubscriptionRepository.Update(sub); } Work.UserSubscriptionRepository.Save(); foreach (var sub in userSubList) { var subTemp = AutoMapper.Mapper.Map <UserSubscription>(sub); var subObj = GetSubscriptionWithLicense(subTemp, user.OrganizationId); subscriptionListWithLicense.Add(subObj); } SubscriptionList subListObj = new SubscriptionList(); subListObj.UserId = userId; subListObj.Subscriptions = subscriptionListWithLicense; return(subListObj); }
public HttpResponseMessage RenewSubscription(string userId, RenewSubscriptionList renewSubList) { Initialize(); var subscriptionList = logic.RenewSubscription(renewSubList, userId); if (!String.IsNullOrEmpty(logic.ErrorMessage)) { return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, logic.ErrorMessage)); } else { return(Request.CreateResponse(HttpStatusCode.OK, subscriptionList)); } }
public static async Task RenewSubscription(RenewSubscriptionList subscriptions) { HttpClient client = WebApiServiceLogic.CreateClient(ServiceType.CentralizeWebApi); var response = await client.PostAsJsonAsync("api/UserSubscription/RenewSubscription/" + LicenseSessionState.Instance.User.ServerUserId, subscriptions); if (response.IsSuccessStatusCode) { var jsonData = response.Content.ReadAsStringAsync().Result; var subscripListObj = JsonConvert.DeserializeObject <SubscriptionList>(jsonData); if (subscripListObj != null) { UpdateSubscriptionOnpremise(subscripListObj, true); } } }
public ActionResult Renew(RenewSubscriptionList renewSub, string[] selectedSubscription) { renewSub.SubscriptionList = new List <SubscriptionType>(); renewSub.RenewalDate = DateTime.Now.Date; if (selectedSubscription.Count() > 0) { foreach (var subId in selectedSubscription) { renewSub.SubscriptionList.Add(new SubscriptionType() { Id = Convert.ToInt32(subId) }); } TempData["RenewSubscription"] = renewSub; return(RedirectToAction("PaymentGateway", "Cart", new { total = renewSub.Price })); } return(View()); }