public CrudResult AddAll <T>(List <T> entityList) where T : class
 {
     try
     {
         var result = _genericCrudRepository.AddAll(entityList);
         return(result ? new CrudResult
         {
             Success = true,
             Message = "Add All Successful",
             Entity = result
         } : new CrudResult
         {
             Success = false,
             Message = "Add All Error",
             Entity = result
         });
     }
     catch (Exception exception)
     {
         return(new CrudResult
         {
             Success = false,
             Message = exception.Message,
             Entity = null
         });
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Inserts a collection of objects into the database and commits the changes
 /// </summary>
 /// <remarks>Synchronous</remarks>
 /// <param name="tList">An IEnumerable list of objects to insert</param>
 /// <returns>The IEnumerable resulting list of inserted objects including the primary keys</returns>
 public IEnumerable <TEntity> AddAll(IEnumerable <TEntity> tList)
 {
     return(_GenericRepository.AddAll(tList.ToList()).ToList());
 }