public JsonResult GetCultureByCountry(int countryId) { var model = new MailChimpListViewModel(); model.Cultures = _countryService.GetCultureByCountry(countryId).ToList(); return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(MailChimpListViewModel model) { int countryId = 0; int cultureId = 0; IList <CountryRecord> countries; IList <CultureRecord> cultures = null; string culture = "en-MY"; countries = _countryService.GetAllCountry().ToList(); if (model.CountryId > 0) { cultures = _countryService.GetCultureByCountry(model.CountryId).ToList(); countryId = model.CountryId; cultureId = model.CultureId; } else { if (countries.Count > 0) { cultures = _countryService.GetCultureByCountry(countries.First().Id).ToList(); countryId = countries.First().Id; if (cultures.Count > 0) { cultureId = cultures.First().Id; } } } var cultureRecord = _cultureRepository.Get(model.CultureId == 0 ? cultureId : model.CultureId); if (cultureRecord != null) { culture = cultureRecord.Culture; } MailChimpListViewModel setting; var pathToTemplates = Server.MapPath("/Modules/Teeyoot.Module/Content/message-templates/" + culture + "/"); var settings = _settingsService.GetSettingByCulture(culture).List().Select(s => new MailChimpListViewModel { Id = s.Id, ApiKey = s.ApiKey, SellerTemplate = System.IO.File.Exists(pathToTemplates + "seller-template.html") ? "seller-template.html" : "No file!", WelcomeTemplate = System.IO.File.Exists(pathToTemplates + "welcome-template.html") ? "welcome-template.html" : "No file!", RelaunchApprovedSellerTemplate = System.IO.File.Exists(pathToTemplates + "relaunch.html") ? "relaunch.html" : "No file!", RelaunchApprovedBuyerTemplate = System.IO.File.Exists(pathToTemplates + "relaunch-buyer.html") ? "relaunch-buyer.html" : "No file!", RelaunchAdminSellerTemplate = System.IO.File.Exists(pathToTemplates + "relaunch-to-admin-seller.html") ? "relaunch-to-admin-seller.html" : "No file!", LaunchTemplate = System.IO.File.Exists(pathToTemplates + "launch-template.html") ? "launch-template.html" : "No file!", WithdrawTemplate = System.IO.File.Exists(pathToTemplates + "withdraw-template.html") ? "withdraw-template.html" : "No file!", PlaceOrderTemplate = System.IO.File.Exists(pathToTemplates + "place-order-template.html") ? "place-order-template.html" : "No file!", NewOrderTemplate = System.IO.File.Exists(pathToTemplates + "new-order-template.html") ? "new-order-template.html" : "No file!", ShippedOrderTemplate = System.IO.File.Exists(pathToTemplates + "shipped-order-template.html") ? "shipped-order-template.html" : "No file!", DeliveredOrderTemplate = System.IO.File.Exists(pathToTemplates + "delivered-order-template.html") ? "delivered-order-template.html" : "No file!", CancelledOrderTemplate = System.IO.File.Exists(pathToTemplates + "cancelled-order-template.html") ? "cancelled-order-template.html" : "No file!", OrderIsPrintingBuyerTemplate = System.IO.File.Exists(pathToTemplates + "order-is-printing-buyer-template.html") ? "order-is-printing-buyer-template" + culture + ".html" : "No file!", CampaignIsPrintingSellerTemplate = System.IO.File.Exists(pathToTemplates + "campaign-is-printing-seller-template.html") ? "campaign-is-printing-seller-template.html" : "No file!", PaidCampaignTemplate = System.IO.File.Exists(pathToTemplates + "paid-campaign-template.html") ? "paid-campaign-template.html" : "No file!", UnpaidCampaignTemplate = System.IO.File.Exists(pathToTemplates + "unpaid-campaign-template.html") ? "unpaid-campaign-template.html" : "No file!", CampaignNotReachGoalBuyerTemplate = System.IO.File.Exists(pathToTemplates + "not-reach-goal-buyer-template.html") ? "not-reach-goal-seller-template.html" : "No file!", CampaignNotReachGoalSellerTemplate = System.IO.File.Exists(pathToTemplates + "not-reach-goal-seller-template.html") ? "not-reach-goal-buyer-template.html" : "No file!", //PartiallyPaidCampaignTemplate = System.IO.File.Exists(pathToTemplates + "partially-paid-campaign-template.html") ? "partially-paid-campaign-template.html" : "No file!", CampaignPromoTemplate = System.IO.File.Exists(pathToTemplates + "campaign-promo-template.html") ? "campaign-promo-template.html" : "No file!", AllOrderDeliveredTemplate = System.IO.File.Exists(pathToTemplates + "all-orders-delivered-seller-template.html") ? "all-orders-delivered-seller-template.html" : "No file!", //CampaignIsFinishedTemplate = System.IO.File.Exists(pathToTemplates + "campaign-is-finished-template.html") ? "campaign-is-finished-template.html" : "No file!", DefinitelyGoSellerTemplate = System.IO.File.Exists(pathToTemplates + "definitely-go-to-print-seller-template.html") ? "definitely-go-to-print-seller-template.html" : "No file!", DefinitelyGoBuyerTemplate = System.IO.File.Exists(pathToTemplates + "definitely-go-to-print-buyer-template.html") ? "definitely-go-to-print-buyer-template.html" : "No file!", EditedCampaignTemplate = System.IO.File.Exists(pathToTemplates + "edited-campaign-template.html") ? "edited-campaign-template.html" : "No file!", ExpiredMetMinimumTemplate = System.IO.File.Exists(pathToTemplates + "expired-campaign-met-minimum-admin-template.html") ? "expired-campaign-met-minimum-admin-template.html" : "No file!", ExpiredNotSuccessfullTemplate = System.IO.File.Exists(pathToTemplates + "expired-campaign-notSuccessfull-admin-template.html") ? "expired-campaign-notSuccessfull-admin-template.html" : "No file!", ExpiredSuccessfullTemplate = System.IO.File.Exists(pathToTemplates + "expired-campaign-successfull-admin-template.html") ? "expired-campaign-successfull-admin-template.html" : "No file!", MakeTheCampaignTemplate = System.IO.File.Exists(pathToTemplates + "make_the_campaign_seller.html") ? "make_the_campaign_seller.html" : "No file!", NewCampaignAdminTemplate = System.IO.File.Exists(pathToTemplates + "new-campaign-admin-template.html") ? "new-campaign-admin-template.html" : "No file!", //NewOrderBuyerTemplate = System.IO.File.Exists(pathToTemplates + "new-order-buyer-template.html") ? "new-order-buyer-template.html" : "No file!", NotReachGoalMetMinimumTemplate = System.IO.File.Exists(pathToTemplates + "not-reach-goal-met-minimum-seller-template.html") ? "not-reach-goal-met-minimum-seller-template.html" : "No file!", RecoverOrdersTemplate = System.IO.File.Exists(pathToTemplates + "recover_orders_for_buyer.html") ? "recover_orders_for_buyer.html" : "No file!", RejectTemplate = System.IO.File.Exists(pathToTemplates + "reject-template.html") ? "reject-template.html" : "No file!", Shipped3DayAfterTemplate = System.IO.File.Exists(pathToTemplates + "shipped-order-3day-after-template.html") ? "shipped-order-3day-after-template.html" : "No file!", TermsConditionsTemplate = System.IO.File.Exists(pathToTemplates + "terms-conditions-template.html") ? "terms-conditions-template.html" : "No file!", WithdrawCompletedTemplate = System.IO.File.Exists(pathToTemplates + "withdraw-completed-template.html") ? "withdraw-completed-template.html" : "No file!", WithdrawSellerTemplate = System.IO.File.Exists(pathToTemplates + "withdraw-seller-template.html") ? "withdraw-seller-template.html" : "No file!" }); if (settings.FirstOrDefault() == null) { setting = new MailChimpListViewModel(); } else { setting = settings.FirstOrDefault(); } setting.Countries = countries; setting.Cultures = cultures; setting.CountryId = countryId; setting.CultureId = cultureId; setting.Culture = culture; return(View(setting)); }