private List <string> ConvertToColumnValues(CourseSubjectModel cs) { List <string> colValues = new List <string>(); try { colValues.Add(cs.SubjectId.ToString()); colValues.Add(cs.CourseId.ToString()); } catch (Exception) { throw; } return(colValues); }
private static CourseSubjectModel ConvertToCourseSubject(Dictionary <string, string> fieldValues) { CourseSubjectModel cs = new CourseSubjectModel(); foreach (KeyValuePair <string, string> row in fieldValues) { switch (row.Key) { case "id": try { cs.CourseSubjectId = int.Parse(row.Value); } catch (Exception) { throw; } break; case "SubjectId": try { cs.SubjectId = int.Parse(row.Value); } catch (Exception) { throw; } break; case "CourseId": try { cs.CourseId = int.Parse(row.Value); } catch (Exception) { throw; } break; default: break; } } return(cs); }