public FacultyBase GetOneForList(string user) { var fac = new Faculty(); foreach (var f in ds.Faculty) { if ((f.Email.Substring(0, (f.Email.IndexOf('@')))).Equals(user)) { fac = f; } } FacultyBase mapped = new FacultyBase(); mapped = Mapper.Map<FacultyBase>(fac); mapped.Sections = new List<Section>(); foreach (var s in ds.Sections) { if (s.Faculty.Id == fac.Id) { mapped.Sections.Add(s); } } return mapped; }
public void Add(string user, string first, string last) { Faculty f = new Faculty(); f.Email = user + "@college.ca"; f.FirstName = first; f.LastName = last; ds.Faculty.Add(f); ds.SaveChanges(); }