예제 #1
0
 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 }));
     }
 }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
 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 }));
     }
 }
예제 #5
0
        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));
        }