public static List<Core.Dto.MessengerDto> GetMessages() { String moduleSettings = ModuleConfig.GetSettings(); Data.Messenger c = new Data.Messenger(moduleSettings); var ds = c.GetMessages(); return (from DataRow rdr in ds.Tables[0].Rows select new Core.Dto.MessengerDto { Id = Convert.ToInt32(rdr["Id"]), Message = Convert.ToString(rdr["Message"]), EndDate = Convert.ToDateTime(rdr["EndDate"]), CreatedDate = Convert.ToDateTime(rdr["CreatedDate"]) }).ToList(); }
public static List<Core.Models.Messenger> GetMessages() { var list = new List<Core.Models.Messenger>(); String moduleSettings = ModuleConfig.GetSettings(); Data.Messenger c = new Data.Messenger(moduleSettings); var ds = c.GetMessages(); foreach (DataRow rdr in ds.Tables[0].Rows) { list.Add(new Core.Models.Messenger { Id = Convert.ToInt32(rdr["Id"]), Message = Convert.ToString(rdr["Message"]), EndDate = Convert.ToDateTime(rdr["EndDate"]), CreatedDate = Convert.ToDateTime(rdr["CreatedDate"]) }); } return list; }