public SubscribersValuesDto AddSubscribersValue(CreateSubscribersValuesInput input) { SubscribersValuesDto results = new SubscribersValuesDto(); return (SubscribersValuesDto)_creditsHeroConnect.CallCreditsHeroService<SubscribersValuesDto>(results, input, "api/services/app/Subscriber/AddSubscribersValue"); }
public async Task<ActionResult> AddSubscribersValue() { string role = GetUserRole(); Users.User user = await GetUser(); CreditsHero.Subscribers.Dtos.GetSubscribersInput input = await BuildCreditsHeroSubscriberInput(user); CreateSubscribersValuesInput inputValues = new CreateSubscribersValuesInput(); var selectedMemberCriteria = _memberAppService.GetMemberSubscriptions(input); foreach (var requestItem in Request.Form.Keys) { foreach (var item in selectedMemberCriteria.SubscriberSkills) { var selectedItem = item.Value.Find(x => x.Id == Int32.Parse(requestItem.ToString())); inputValues.SubscribersId = input.SubscribersId.Value; if (selectedItem == null) { inputValues.CriteriaValuesRefId = Int32.Parse(requestItem.ToString()); inputValues.IsDeleted = Request.Form.GetValues(requestItem.ToString())[0] == "on" ? false : true; } else { inputValues.CriteriaValuesRefId = selectedItem.Id; inputValues.IsDeleted = Request.Form.GetValues(selectedItem.Id.ToString())[0] == "on" ? false : true; } _memberAppService.AddSubscribersValue(inputValues); } } //Need to do this to clean up the skills that have been removed from the list foreach (var item in selectedMemberCriteria.SubscriberSkills) { var unselectedItems = item.Value.Where(x => !Request.Form.AllKeys.Any(i => i == x.Id.ToString())).ToList(); foreach (var unselectedItem in unselectedItems) { inputValues.SubscribersId = input.SubscribersId.Value; inputValues.CriteriaValuesRefId = unselectedItem.Id; inputValues.IsDeleted = true; _memberAppService.AddSubscribersValue(inputValues); } } rooferlocator.com.Web.Models.ServiceResponse response = new Models.ServiceResponse() { FriendlyMessage = "Service Updated." }; return Redirect((Url.Action("ServicesOffered", "Members", response))); }