public async Task <T> Add(T entity)
 {
     _oefenplatformContext.Set <T>().Add(entity);
     try
     {
         await _oefenplatformContext.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         return(null);
     }
     return(entity);
 }
Beispiel #2
0
 public async Task <SchoolUser> Add(SchoolUser entity)
 {
     //_oefenplatformContext.Add(entity);
     _oefenplatformContext.Set <SchoolUser>().Add(entity); //Use this Set or just Add?
     try
     {
         await _oefenplatformContext.SaveChangesAsync();
     }
     catch
     {
         Console.WriteLine("Test failed");
         return(null); //tests resolve into this
     }
     return(entity);
 }