Пример #1
0
        public ActionResult GetVendorById(VendorViewModel vViewModel)
        {
            try

            {
                vViewModel.Vendor = _vRepo.GetVendorById(vViewModel.Filter.VendorId);

                var Business = vViewModel.Vendor.BusinessId.Split(',');

                int number = Business.Length;

                if (Business.Length == 1)
                {
                    number = 2;
                }

                vViewModel.BusinessList = new List <BusinessInfo>();

                for (int i = 0; i < number - 1; i++)
                {
                    vViewModel.BusinessList.Add(new BusinessInfo());
                }

                if (Business.Length != 0)
                {
                    int i = 0;

                    foreach (var item in Business)
                    {
                        if (item != "")
                        {
                            vViewModel.BusinessList[i].BusinessId = item;

                            i++;
                        }
                    }
                }

                var Payment = vViewModel.Vendor.PaymentOptionId.Split(',');

                int number1 = Payment.Length;

                if (Payment.Length == 1)
                {
                    number1 = 2;
                }

                vViewModel.PaymentOptionList = new List <VendorInfo>();

                for (int i = 0; i < number1 - 1; i++)
                {
                    vViewModel.PaymentOptionList.Add(new VendorInfo());
                }

                if (Payment.Length != 0)
                {
                    int i = 0;

                    foreach (var item1 in Payment)
                    {
                        if (item1 != "")
                        {
                            vViewModel.PaymentOptionList[i].PaymentOptionId = item1;

                            i++;
                        }
                    }
                }

                Logger.Debug("Vendor Controller GetVendorById");
            }
            catch (Exception ex)
            {
                vViewModel.FriendlyMessage.Add(MessageStore.Get("SYS01"));

                Logger.Error("Vendor Controller - GetVendorById" + ex.ToString());
            }

            TempData["vViewModel"] = vViewModel;

            return(Index(vViewModel));
        }