public static Entities.StudentDocument CreateStudentDocument(int studentId, string fileName, byte[] contents, int userId) { var result = new Entities.StudentDocument { Contents = contents, CreatedBy = userId, CreatedOn = DateTime.Now, Name = fileName, StudentId = studentId }; using (var context = DataContext.GetContext()) { context.StudentDocuments.AddObject(result); context.SaveChanges(); } return result; }
public static Entities.StudentDocument CreateStudentDocument(int studentId, string fileName, byte[] contents, int userId) { var result = new Entities.StudentDocument { Contents = contents, CreatedBy = userId, CreatedOn = DateTime.Now, Name = fileName, StudentId = studentId }; using (var context = DataContext.GetContext()) { context.StudentDocuments.AddObject(result); context.SaveChanges(); } return(result); }