public async Task <SiteSetting> Set(SiteSetting siteSetting)
        {
            var entity = await _db.SiteSettings.FindAsync(siteSetting.Id);

            _db.Entry(entity).CurrentValues.SetValues(siteSetting);
            await _db.SaveChangesAsync();

            return(entity);
        }
Beispiel #2
0
        public async Task Delete(int id)
        {
            var style = await _db.Styles.FindAsync(id);

            var carts = await _db.Carts.Where(x => x.StyleId.Equals(id)).ToListAsync();

            _db.Carts.RemoveRange(carts);
            _db.Styles.Remove(style);
            await _db.SaveChangesAsync();
        }
Beispiel #3
0
        public async Task <IActionResult> Post(UpdateCategoryOrderRequest updatePositionsRequest)
        {
            foreach (var position in updatePositionsRequest.Positions)
            {
                var categoryEntity = await _db.Categories.FindAsync(position.CategoryId);

                categoryEntity.Position = position.Index;
            }
            await _db.SaveChangesAsync();

            return(Ok());
        }
 public async Task Create(Review review)
 {
     review.DateCreated = DateTime.Now;
     _db.Reviews.Add(review);
     await _db.SaveChangesAsync();
 }
Beispiel #5
0
 public async Task Create(Order order)
 {
     _db.Orders.Add(order);
     await _db.SaveChangesAsync();
 }
 public async Task Create(Image image)
 {
     _db.Images.Add(image);
     await _db.SaveChangesAsync();
 }
Beispiel #7
0
 public async Task Add(Cart cart)
 {
     _db.Carts.Add(cart);
     await _db.SaveChangesAsync();
 }
 public async Task Create(ProductImage productImage)
 {
     _db.ProductImages.Add(productImage);
     await _db.SaveChangesAsync();
 }
 public async Task Update(Category category)
 {
     _db.Entry(category).State = EntityState.Modified;
     await _db.SaveChangesAsync();
 }
Beispiel #10
0
 public async Task Create(ProductCategory productCategory)
 {
     _db.ProductCategories.Add(productCategory);
     await _db.SaveChangesAsync();
 }
Beispiel #11
0
 public async Task Create(Color color)
 {
     _db.Colors.Add(color);
     await _db.SaveChangesAsync();
 }
Beispiel #12
0
 public async Task Create(Size size)
 {
     _db.Sizes.Add(size);
     await _db.SaveChangesAsync();
 }
 public async Task Create(Product product)
 {
     _db.Products.Add(product);
     await _db.SaveChangesAsync();
 }
 public async Task Set(PublicSiteProfile entity)
 {
     _db.PublicSiteProfiles.Add(entity);
     await _db.SaveChangesAsync();
 }
Beispiel #15
0
 public async Task Set(SiteSetting siteSetting)
 {
     _db.SiteSettings.Add(siteSetting);
     await _db.SaveChangesAsync();
 }
Beispiel #16
0
 public async Task Create(GuestUser user)
 {
     _db.GuestUsers.Add(user);
     await _db.SaveChangesAsync();
 }