public string GetAllCountries() { try { List <CountryViewModel> CountryList = Mapper.Map <List <Country>, List <CountryViewModel> >(_masterBusiness.GetAllCountries()); return(JsonConvert.SerializeObject(new { Result = "OK", Records = CountryList })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } }
public ActionResult Index() { OrderViewModel order = null; try { order = new OrderViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); List <SelectListItem> selectListPaymentStatus = new List <SelectListItem>(); //Country Drop down bind List <CountryViewModel> CounrtyList = Mapper.Map <List <Country>, List <CountryViewModel> >(_masterBusiness.GetAllCountries()); foreach (CountryViewModel ccl in CounrtyList) { selectListItem.Add(new SelectListItem { Text = ccl.Name, Value = ccl.Code, Selected = false }); } order.Countries = selectListItem; List <PaymentStatusViewModel> paymentstatusListVM = Mapper.Map <List <PaymentStatusMaster>, List <PaymentStatusViewModel> >(_masterBusiness.GetAllPaymentStatus()); foreach (PaymentStatusViewModel pvm in paymentstatusListVM) { selectListPaymentStatus.Add(new SelectListItem { Text = pvm.Description, Value = pvm.Code.ToString(), Selected = false }); } order.PaymentStatusList = selectListPaymentStatus; } catch (Exception ex) { throw ex; } return(View(order)); }
public ActionResult Index() { CustomerViewModel customer = null; try { customer = new CustomerViewModel(); customer.customerAddress = new CustomerAddressViewModel(); customer.customerAddress.country = new CountryViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); //Countries drop down bind List <CountryViewModel> countryListVM = Mapper.Map <List <Country>, List <CountryViewModel> >(_masterBusiness.GetAllCountries()); foreach (CountryViewModel cvm in countryListVM) { selectListItem.Add(new SelectListItem { Text = cvm.Name, Value = cvm.Code.ToString(), Selected = false }); } customer.customerAddress.Countries = selectListItem; } catch (Exception ex) { throw ex; } return(View(customer)); }
public object GetCountries() { try { List <CountryViewModel> CartList = Mapper.Map <List <Country>, List <CountryViewModel> >(_masterBusiness.GetAllCountries()); if (CartList.Count == 0) { throw new Exception(constants.NoItems); } return(JsonConvert.SerializeObject(new { Result = true, Records = CartList })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message })); } }
public ActionResult Index() { ManufacturerViewModel Country_obj = new ManufacturerViewModel(); List <SelectListItem> selectListItem = new List <SelectListItem>(); List <CountryViewModel> orderstatusListVM = Mapper.Map <List <Country>, List <CountryViewModel> >(_masterBusiness.GetAllCountries()); foreach (CountryViewModel ovm in orderstatusListVM) { selectListItem.Add(new SelectListItem { Text = ovm.Name, Value = ovm.Code, Selected = false }); } Country_obj.CountryList = selectListItem; return(View(Country_obj)); }