public List <B2CVisitorInfoModel> ListB2CVisitorInfoReport() { int sno = 0; var data = ent.VisitorInfo; List <B2CVisitorInfoModel> model = new List <B2CVisitorInfoModel>(); foreach (var item in data.Select(x => x).OrderByDescending(x => x.CreatedDate)) { sno++; var B2CVisitorInfoModel = new B2CVisitorInfoModel(); B2CVisitorInfoModel.SN0 = sno; B2CVisitorInfoModel.VisitorId = (int)item.VisitorId; B2CVisitorInfoModel.Name = item.Name; B2CVisitorInfoModel.Address = item.Address; B2CVisitorInfoModel.Email = item.Email; B2CVisitorInfoModel.ContactNo = item.ContactNo; B2CVisitorInfoModel.SRC = item.SRC; B2CVisitorInfoModel.Type = item.Type; B2CVisitorInfoModel.Profession = item.Profession; B2CVisitorInfoModel.CreatedDate = item.CreatedDate; model.Add(B2CVisitorInfoModel); } return(model.ToList()); }
public ActionResult Index(int?page) { int currentPageIndex = page.HasValue ? page.Value : 1; int defaultPageSize = 30; B2CVisitorInfoModel model = new B2CVisitorInfoModel(); model.ListB2CVisitorInfo = ser.ListB2CVisitorInfoReport().ToPagedList(currentPageIndex, defaultPageSize); return(View(model)); }
public ActionResult Index(ExportModel Expmodel, B2CVisitorInfoModel model, FormCollection frm) { model.ListB2CVisitorInfo = ser.ListB2CVisitorInfoReport().ToPagedList(1, int.MaxValue); //export bktctrl.GetExportTypeClicked(Expmodel, frm); if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null)) { try { if (Expmodel.ExportTypeExcel != null) { Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel; } else if (Expmodel.ExportTypeWord != null) { Expmodel.ExportTypeWord = Expmodel.ExportTypeWord; } else if (Expmodel.ExportTypePdf != null) { Expmodel.ExportTypePdf = Expmodel.ExportTypePdf; } var exportData = model.ListB2CVisitorInfo.Select(m => new { Name = m.Name, Address = m.Address, Email = m.Email, Contact_No = m.ContactNo, Source = m.SRC, Type = m.Type, Profession = m.Profession, Created_Date = m.CreatedDate }); App_Class.AppCollection.Export(Expmodel, exportData, "Visitor_Info"); } catch { } } return(View(model)); }