/// <summary> /// Indexes this instance. /// </summary> /// <returns></returns> public ActionResult Index() { ViewBag.CountryList = CountriesHelper.GetCountries(); var model = new PurchaseOrderViewModel(); return(View(model)); }
public void FillUpCountries() { CountriesHelper Countries = new CountriesHelper(); cmbCountries.DataSource = Countries.Data; //Countries.Data; cmbCountries.ValueMember = "Id"; cmbCountries.DisplayMember = "CountryName"; }
public ActionResult Index(PurchaseOrderViewModel purchaseOrder) { if (ModelState.IsValid) { try { var model = new PurchaseOrder { Email = purchaseOrder.Email, Apartament = purchaseOrder.Apartament, City = purchaseOrder.City, Country = purchaseOrder.Country, Name = purchaseOrder.Name, Sreet = purchaseOrder.Sreet, State = purchaseOrder.State, ZipCode = purchaseOrder.ZipCode, Status = PurchaseOrderStatus.Initial }; string url = ConfigurationManager.AppSettings["PayPalLink"] + "?cmd=_xclick&business=" + HttpUtility.UrlPathEncode(ConfigurationManager.AppSettings["PayPalEmail"] + "&item_name=BlochsTech Bitcoin Card&first_name=" + purchaseOrder.Name + "&address1=" + purchaseOrder.Sreet + "&address2=" + purchaseOrder.Apartament + "&city=" + purchaseOrder.City + "&state=" + purchaseOrder.State + "&zip=" + purchaseOrder.ZipCode.ToString() + "&country=" + purchaseOrder.Country + "&quantity=1¤cy_code=EUR&amount=" + ConfigurationManager.AppSettings["PriceSimpleCard"] + "&email=" + purchaseOrder.Email + "&return=" + Url.Action("Thankyou", "Home", null, protocol: Request.Url.Scheme) + "¬ify_url=" + Url.Action("PaypalIpn", "Home", null, protocol: Request.Url.Scheme)); MailHelper.SendEmail(model.Name, model.Email, url); Bootstrap.Log.Info("Send email to client {0} and email: {1}.", model.Name, model.Email); model = _purchaseOrderService.Create(model); url += "&custom=" + model.Id; Bootstrap.Log.Info("Client with name {0} and email: {1}. Save to database.", model.Name, model.Email); Bootstrap.Log.Info("Client with email: {0}. Redirect to {1}", model.Email, url); Response.Redirect(url); } catch (Exception e) { Bootstrap.Log.Error("Error message: {0}\n Stack Trace: {1}", e.Message, e.StackTrace); } return(RedirectToAction("Index")); } ViewBag.CountryList = CountriesHelper.GetCountries(); return(View("Index", purchaseOrder)); }
private void PopulateDropDownListAndKeys(AdvertisementViewModel model = null) { ViewBag.Skills = new List <SelectListItem>(_subdataService.GetSkills() .Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name, Selected = model?.SelectedSkills != null && model.SelectedSkills.Any(y => x.Id.ToString() == y) })); ViewBag.Industries = new List <SelectListItem>(_subdataService.GetIndustries() .Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name, Selected = model?.SelectedIndustries != null && model.SelectedIndustries.Any(y => x.Id.ToString() == y) })); ViewBag.AdvertisementTypes = new List <SelectListItem>() { new SelectListItem { Text = ResourceString.Instance.Image, Value = ((int)AdvertisementType.Image).ToString(), Selected = model?.Type == AdvertisementType.Image }, new SelectListItem { Text = ResourceString.Instance.Video, Value = ((int)AdvertisementType.Video).ToString(), Selected = model?.Type == AdvertisementType.Video }, }; ViewBag.LocationType = new List <SelectListItem>() { new SelectListItem { Text = ResourceString.Instance.WithoutLocation, Value = ((int)LocationType.WithoutLocation).ToString(), Selected = model?.LocationType == LocationType.WithoutLocation }, new SelectListItem { Text = ResourceString.Instance.Country, Value = ((int)LocationType.Country).ToString(), Selected = model?.LocationType == LocationType.Country }, new SelectListItem { Text = ResourceString.Instance.Cities, Value = ((int)LocationType.Cities).ToString(), Selected = model?.LocationType == LocationType.Cities }, }; ViewBag.CountriesList = CountriesHelper.GetCountriesList()?.Select(c => new SelectListItem { Text = c, Value = c, Selected = model?.Location?.Equals(c) == true }); //API KEYS ViewBag.GoogleApiKey = ConfigurationManager.AppSettings["GOOGLEMAPS_API_KEY"]; ViewBag.PaylikePublicKey = ConfigurationManager.AppSettings["PAYLIKE_PUBLIC_KEY"]; }