コード例 #1
0
 public void Add(Student student)
 {
     try
     {
         if (student != null)
         {
             Student newEntity = dbSet.Add(student);
             dbSet.Attach(newEntity);
             context.Entry(newEntity).State = EntityState.Added;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
 public void Add(News news)
 {
     try
     {
         if (news != null)
         {
             News newEntity = dbSet.Add(news);
             dbSet.Attach(newEntity);
             context.Entry(newEntity).State = EntityState.Added;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
 public void Add(Department department)
 {
     try
     {
         if (department != null)
         {
             Department newEntity = dbSet.Add(department);
             dbSet.Attach(newEntity);
             context.Entry(newEntity).State = EntityState.Added;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #4
0
 public void Add(Event events)
 {
     try
     {
         if (events != null)
         {
             Event newEntity = dbSet.Add(events);
             dbSet.Attach(newEntity);
             context.Entry(newEntity).State = EntityState.Added;
         }
     }
     catch (Exception)
     {
         throw;
     }
 }