Exemplo n.º 1
0
 public ActionResult Vendor()
 {
     try
     {
         var vendors = VendorAction.GetAllVendors();
         return(View(vendors));
     }
     catch (RenewTokenException)
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemplo n.º 2
0
        public ActionResult Download(string type)
        {
            string fileContent;
            string outputFileName;

            if (string.Equals(type, "account", StringComparison.OrdinalIgnoreCase))
            {
                fileContent    = JsonConvert.SerializeObject(AccountAction.GetAllAccounts());
                outputFileName = "accounts.txt";
            }
            else //"vendor"
            {
                fileContent    = JsonConvert.SerializeObject(VendorAction.GetAllVendors());
                outputFileName = "vendor.txt";
            }
            byte[] data = Encoding.UTF8.GetBytes(fileContent);
            return(File(data, "text/plain", outputFileName));
        }