Ejemplo n.º 1
0
 public async Task EnableUsers(IEnumerable <User> users)
 {
     using (var sequenceEnum = users.GetEnumerator())
     {
         while (sequenceEnum.MoveNext())
         {
             var user = GetById(sequenceEnum.Current.UserId).Result;
             user.IsEnabled = sequenceEnum.Current.IsEnabled;
             _dataMarketDbContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 2
0
        public async Task DeleteById(int id)
        {
            var savedFilter = _dataMarketDbContext.SavedFilters
                              .Where(f => f.SavedFilterId == id).FirstOrDefault();

            _dataMarketDbContext.SavedFilters.Remove(savedFilter);
            _dataMarketDbContext.SaveChanges();

            var query = "Drop table SequenceForList_" + id.ToString();

            SqlConnection objConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DataMarketConnectionString"].ConnectionString);
            {
                objConnection.Open();

                using (SqlCommand cmd = new SqlCommand(query, objConnection))
                {
                    cmd.ExecuteNonQuery();
                }
                objConnection.Close();
            }
        }