public static Lottery GetLotteryDetailByID(int autoid) { var model = CommonBusiness.LottertList.Where(x => x.AutoID == autoid).FirstOrDefault(); if (model != null && !string.IsNullOrEmpty(model.CPName)) { return(model); } else { DataTable dt = new CommonDAL().GetLotteryList(); List <Lottery> lottertList = new List <Lottery>(); foreach (DataRow dr in dt.Rows) { Lottery mod = new Lottery(); mod.FillData(dr); lottertList.Add(mod); } CommonBusiness.LottertList = lottertList; return(CommonBusiness.LottertList.Where(x => x.AutoID == autoid).FirstOrDefault()); } }