public Semesters createSemester(string name) { using (var db = new NTR2013Entities()) { var original = db.Semesters.ToList(); foreach (Semesters s in original) { if (s.Name.Trim().Equals(name)) { return(null); } } var semester = new Semesters { Name = name }; db.Semesters.Add(semester); db.SaveChanges(); return(semester); } }
public Semesters createSemester(string name) { using (var db = new NTR2013Entities()) { var original = db.Semesters.ToList(); foreach (Semesters s in original) { if (s.Name.Trim().Equals(name)) return null; } var semester = new Semesters { Name = name }; db.Semesters.Add(semester); db.SaveChanges(); return semester; } }