Exemplo n.º 1
0
 public async Task AddAsync(StudentToGame StudentToGame)
 {
     try
     {
         await m_repository.CreateAsync(StudentToGame);
     }
     catch (ValidationException e)
     {
         m_logger.LogWarning(e, "A validation failed");
         throw;
     }
     catch (Exception e) when(e.GetType() != typeof(ValidationException))
     {
         m_logger.LogCritical(e, $"Unexpected Exception while trying to create a StudentToGame with the properties : {JsonConvert.SerializeObject(StudentToGame, Formatting.Indented)}");
         throw;
     }
 }
 public async Task DeleteAsync(StudentToGame entity)
 {
     m_dataContext.StudentToGames.Remove(entity);
     await m_dataContext.SaveChangesAsync();
 }
        public async Task CreateAsync(StudentToGame entity)
        {
            await m_dataContext.StudentToGames.AddAsync(entity);

            await m_dataContext.SaveChangesAsync();
        }