コード例 #1
0
        public IActionResult DownloadSellerCatalogue([FromForm] int sellerId)
        {
            try
            {
                int activeVersion = _catalogue.GetActiveCatalogueVersionId(sellerId);

                if (sellerId > 0 && activeVersion > 0)
                {
                    string csvData = _catalogue.GenerateSellerCatalogueCSV(sellerId, activeVersion);
                    return(File(new UTF8Encoding().GetBytes(csvData), "text/csv", string.Format("seller-{0}-{1}.csv", sellerId, activeVersion)));
                }
                else
                {
                    return(View("~/Views/Home/SellerFailure.cshtml"));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Error: DownloadSellerCatalogue. Exception: {0}", e.Message));
                return(View("~/Views/Home/SellerFailure.cshtml"));
            }
        }