public static void Import(string csv)
        {
            var csvMapper = new CsvMapper();
            //var csv = File.ReadAllText(@"D:\Dev\git\FatDividends\_documentation\D&E\earning_cba.csv");
            var mappings = new Dictionary<string, int>
                {
                    {"StockCode", 0},
                    {"Year", 1},
                    {"Period", 2},
                    {"ReportedDate", 3},
                    {"NPAT", 4},
                    {"Margin", 5},
                    {"CashFlow", 6},
                    {"EPS", 7},
                    {"DPS", 8},
                    {"ROE", 9}
                };

            var earnings = csvMapper.MapCsvTo<StockEarning>(mappings, csv, true);

            using (var service = new EarningService())
            {
                service.Add(earnings);
            }
        }
 public static IEnumerable<StockEarning> GetLatest(DynamicNodeContext nodeContext, int count)
 {
     using (var service = new EarningService())
     {
         return service.Get(count).ToList();
     }
 }
 public static IEnumerable<StockEarning> Get(DynamicNodeContext nodeContext, int count)
 {
     using (var service = new EarningService())
     {
         var stockCode = HttpContext.Current.Request.QueryString["code"];
         return service.Get(stockCode, count).ToList();
     }
 }
        public static void Import(StockEarning earning)
        {
            var earnings = new List<StockEarning>() { earning };

            using (var service = new EarningService())
            {
                service.Add(earnings);
            }
        }
 public EarningController()
 {
     _earningService = new EarningService();
 }