internal void AddItemToDB(ProductsCreateVM product) { Products x = new Products(); x.Brand = product.Brand; x.Description = product.Description; x.ImgUrl = product.ImgUrl; x.Price = product.Price; x.Name = product.Name; context.Products.Add(x); context.SaveChanges(); var productId = GetProductID(x); foreach (var item in product.SelectedTemperValues) { Products2Stores p2s = new Products2Stores() { ProductId = productId, StoreId = item }; context.Products2Stores.Add(p2s); } context.SaveChanges(); }
internal void AddRatingToDB(RatingAddVM ra) { Rating x = new Rating(); x.ProductId = ra.SelectedProductValue; x.Rating1 = ra.Rating; x.Comment = ra.Comment; x.UserId = ra.UserId; context.Rating.Add(x); context.SaveChanges(); }