Exemplo n.º 1
0
        /// <summary>
        /// Update multi fields of entity
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="entity"></param>
        /// <returns></returns>
        #region
        public async Task <bool> UpdateMultiField(List <T> entity)
        {
            try
            {
                var listEntity = _db.Set <T>().AsNoTracking().Where(p => entity.Contains(p));
                if (listEntity != null)
                {
                    _db.UpdateRange(entity);
                    await _db.SaveChangesAsync();

                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            {
                var error = e.Message;
                return(await Task.FromResult <bool>(false));
            }
        }