public async Task Add(KnowledgeCategory knowledgeCategory)
        {
            var dbContext = new LMDbContext();
            await dbContext.KnowledgeCategories.AddAsync(knowledgeCategory);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task Add(List <ShopCategory> shopCategories)
        {
            var dbContext = new LMDbContext();
            await dbContext.ShopCategories.AddRangeAsync(shopCategories);

            await dbContext.SaveChangesAsync();
        }
        public async Task Add(List <KnowledgeCategory> knowledgeCategories)
        {
            var dbContext = new LMDbContext();
            await dbContext.KnowledgeCategories.AddRangeAsync(knowledgeCategories);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 4
0
        public async Task Add(List <ShopItem> shopItems)
        {
            var dbContext = new LMDbContext();
            await dbContext.ShopItems.AddRangeAsync(shopItems);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 5
0
        public async Task Add(ShopCategory shopCategory)
        {
            var dbContext = new LMDbContext();
            await dbContext.ShopCategories.AddAsync(shopCategory);

            await dbContext.SaveChangesAsync();
        }
        public async Task Add(List <Article> articles)
        {
            var dbContext = new LMDbContext();
            await dbContext.Articles.AddRangeAsync(articles);

            await dbContext.SaveChangesAsync();
        }
        public async Task Add(Article article)
        {
            var dbContext = new LMDbContext();
            await dbContext.Articles.AddAsync(article);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 8
0
    public async Task Add(Category category)
    {
        var dbContext = new LMDbContext();
        await dbContext.Categories.AddAsync(category);

        await dbContext.SaveChangesAsync();
    }
        public async Task AddProduct(Product product)
        {
            var dbContext = new LMDbContext();
            await dbContext.Products.AddAsync(product);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 10
0
        public async Task Add(ShopItem shopItem)
        {
            var dbContext = new LMDbContext();
            await dbContext.ShopItems.AddAsync(shopItem);

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 11
0
    public async Task Update(Category category)
    {
        var dbContext        = new LMDbContext();
        var categoryToUpdate = await dbContext.Categories.FirstOrDefaultAsync(c => c.Id == category.Id);

        categoryToUpdate = category;
        await dbContext.SaveChangesAsync();
    }
Exemplo n.º 12
0
        public async Task ConfirmEmailAsync(string email)
        {
            var context = new LMDbContext();
            var user    = await context.Users.FirstOrDefaultAsync(u => u.Username.ToUpper() == email.ToUpper());

            user.IsConfirmed = true;
            await context.SaveChangesAsync();
        }
Exemplo n.º 13
0
        public async Task Update(ShopItem shopItem)
        {
            var dbContext        = new LMDbContext();
            var shopItemToUpdate = await dbContext.ShopItems.FirstOrDefaultAsync(c => c.Id == shopItem.Id);

            shopItemToUpdate = shopItem;
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 14
0
        public async Task UpdateProduct(Product product)
        {
            var dbContext       = new LMDbContext();
            var productToUpdate = await dbContext.Products.FirstOrDefaultAsync(p => p.Id == product.Id);

            productToUpdate = product;
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 15
0
        public async Task Update(Article article)
        {
            var dbContext       = new LMDbContext();
            var articleToUpdate = await dbContext.Articles.FirstOrDefaultAsync(c => c.Id == article.Id);

            articleToUpdate = article;
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 16
0
        public async Task Delete(int articleId)
        {
            var dbContext = new LMDbContext();
            var article   = await dbContext.Articles.FirstOrDefaultAsync(c => c.Id == articleId);

            dbContext.Remove(article);
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 17
0
        public async Task DeleteProduct(string productId)
        {
            var dbContext = new LMDbContext();
            var product   = await dbContext.Products.FirstOrDefaultAsync(p => p.Id == productId);

            dbContext.Products.Remove(product);
            await dbContext.SaveChangesAsync();
        }
        public async Task Delete(int shopItemFeedbackId)
        {
            var dbContext        = new LMDbContext();
            var shopItemFeedback = await dbContext.ShopItemFeedbacks.FirstOrDefaultAsync(c => c.Id == shopItemFeedbackId);

            dbContext.Remove(shopItemFeedback);
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 19
0
    public async Task Delete(string categoryId)
    {
        var dbContext = new LMDbContext();
        var category  = await dbContext.Categories.FirstOrDefaultAsync(c => c.Id == categoryId);

        dbContext.Remove(category);
        await dbContext.SaveChangesAsync();
    }
Exemplo n.º 20
0
        public async Task Update(ShopCategory shopCategory)
        {
            var dbContext            = new LMDbContext();
            var shopCategoryToUpdate = await dbContext.ShopCategories.FirstOrDefaultAsync(c => c.Id == shopCategory.Id);

            shopCategoryToUpdate = shopCategory;
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 21
0
        public async Task Update(KnowledgeCategory knowledgeCategory)
        {
            var dbContext = new LMDbContext();
            var knowledgeCategoryToUpdate = await dbContext.KnowledgeCategories.FirstOrDefaultAsync(c => c.Id == knowledgeCategory.Id);

            knowledgeCategoryToUpdate = knowledgeCategory;
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 22
0
        public async Task Delete(int shopCategoryId)
        {
            var dbContext    = new LMDbContext();
            var shopCategory = await dbContext.ShopCategories.FirstOrDefaultAsync(c => c.Id == shopCategoryId);

            dbContext.Remove(shopCategory);
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 23
0
        public async Task Delete(string knowledgeCategoryId)
        {
            var dbContext         = new LMDbContext();
            var knowledgeCategory = await dbContext.KnowledgeCategories.FirstOrDefaultAsync(c => c.Id == int.Parse(knowledgeCategoryId));

            dbContext.Remove(knowledgeCategory);
            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 24
0
        public async Task Add(User user)
        {
            var context = new LMDbContext();

            user.Password = _hasher.HashPassword(user.Password);
            await context.Users.AddAsync(user);

            await context.SaveChangesAsync();
        }
Exemplo n.º 25
0
        public async Task UpdateRefreshToken(User user)
        {
            var context = new LMDbContext();
            var dbUser  = await FindByUsernameAsync(user.Username);

            context.Update(dbUser);
            dbUser.RefreshTokensStr = JsonConvert.SerializeObject(user.RefreshTokens);
            context.Update(dbUser);
            await context.SaveChangesAsync();
        }
Exemplo n.º 26
0
        public async Task <bool> TryChangePasswordAsync(string newPassword)
        {
            var context = new LMDbContext();
            var dbUser  = await context.Users
                          .FirstOrDefaultAsync(u => u.Username.ToUpper() == GlobalHelpers.CurrentUser.Username.ToUpper());

            dbUser.Password = _hasher.HashPassword(newPassword);
            await context.SaveChangesAsync();

            return(true);
        }
Exemplo n.º 27
0
        public async Task <DailyNutrition> Add(DailyNutrition dailyNutrition)
        {
            dailyNutrition.Id     = null;
            dailyNutrition.UserId = GlobalHelpers.CurrentUser.Id;
            var dbContext = new LMDbContext();
            await dbContext.DailyNutritions.AddAsync(dailyNutrition);

            await dbContext.SaveChangesAsync();

            return(dailyNutrition);
        }
Exemplo n.º 28
0
        public async Task Delete(string nutritionId)
        {
            if (GlobalHelpers.CurrentUser.DailyNutritions.Any(dn => dn.Id == nutritionId))
            {
                var context        = new LMDbContext();
                var dailyNutrition = await context.DailyNutritions.FirstOrDefaultAsync(dn => dn.Id == nutritionId);

                context.DailyNutritions.Remove(dailyNutrition);
                await context.SaveChangesAsync();
            }
        }
        public async Task Add(List <ShopItemFeedback> shopItemFeedbacks)
        {
            foreach (var item in shopItemFeedbacks)
            {
                item.Date = DateTime.Now;
            }

            var dbContext = new LMDbContext();
            await dbContext.ShopItemFeedbacks.AddRangeAsync(shopItemFeedbacks);

            await dbContext.SaveChangesAsync();
        }