public List <PositionVm> GetList(PositionVm p, ref string msg) { List <PositionVm> items = new List <PositionVm>(); DataTable dt = db.GetList(MapProperties(p), ref msg); if (msg != "") { return(new List <PositionVm>()); } try { foreach (DataRow row in dt.Rows) { PositionVm item = new PositionVm(); item.Id = row["PositionId"].GetString(); item.Title = row["title"].GetString(); item.PositionType = row["positionType"].GetString(); item.Details = row["details"].GetString(); item.CreatedById = row["createdById"].GetString(); item.CreatedBy = row["createdByName"].GetString(); item.CreatedOn = row["createdOn"].GetDateTime().GetString(); item.ModifiedById = row["modifiedById"].GetString(); item.ModifiedBy = row["modifiedByName"].GetString(); item.ModifiedOn = row["modifiedOn"].GetNullableDateTime().GetString(); items.Add(item); } return(items); } catch (Exception ex) { msg = ef.GetExceptionMessage(ex, msg); return(new List <PositionVm>()); } }