示例#1
0
        public ActionResult _Index(int?id)
        {
            checkVatPortTypeClient client = new checkVatPortTypeClient();
            Vat vat;
            CompanyBindingModel companyDetails = new CompanyBindingModel();

            using (InnovasysVatContext context = new InnovasysVatContext())
            {
                vat = context.Vats.FirstOrDefault(v => v.Id == id);
            }

            if (vat != null)
            {
                string countryCode = vat.VatNumber.Substring(0, 2);
                string vatNumber   = vat.VatNumber.Substring(2, vat.VatNumber.Length - 2).TrimEnd();
                client.checkVat(ref countryCode, ref vatNumber, out var isValid, out var name, out var address);
                companyDetails.VatNumber   = vatNumber;
                companyDetails.CountryCode = countryCode;
                companyDetails.Address     = address;
                companyDetails.Name        = name;
                companyDetails.IsValid     = isValid;
            }

            client.Close();

            return(PartialView(companyDetails));
        }
示例#2
0
 public ActionResult Index()
 {
     using (InnovasysVatContext context = new InnovasysVatContext())
     {
         List <Vat> viewModel = context.Vats.ToList();
         return(View(viewModel));
     }
 }