Example #1
0
 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;
 }
Example #2
0
        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);
        }