public async Task <IActionResult> Edit(int id, TypeOfProduct typeOfProduct) { if (id != typeOfProduct.Id) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } if (ModelState.IsValid) { try { _repository.Update <TypeOfProduct>(typeOfProduct); await _repository.SavaAll(); } catch (DbUpdateConcurrencyException) { if (_repository.GetLevel(typeOfProduct.Id) == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(typeOfProduct)); }
public Product(string brand, long barcode, double price, TypeOfProduct typeOfProduct) { Brand = brand; BarCode = barcode; Price = price; TypeOfProduct = typeOfProduct; }
public void StartCooking() { TypeOfProduct = TypeOfProduct.Empty; Empty.SetActive(true); Full.SetActive(false); GreenProgress.StartTimer(CookingTime, CompleteCooking); }
public List <TypeOfActionAgainstOrder> RunRulesForProduct(TypeOfProduct product) { var learningToSkiVideoRule = new LearningToSkiVideoRule(null, product); var upgradeMembershipRule = new UpgradeMembershipRule(learningToSkiVideoRule, product); var newMembershipRule = new NewMembershipRule(upgradeMembershipRule, product); var bookRule = new BookRule(newMembershipRule, product); var ruleChain = new PhysicalProductRule(bookRule, product); return(ruleChain.VerifyRuleAndProcess()); }
public async Task <IActionResult> Create(TypeOfProduct typeOfProduct) { if (ModelState.IsValid) { _repository.Add <TypeOfProduct>(typeOfProduct); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(typeOfProduct)); }
public bool AddType(TypeOfProduct type) { try { _context.TypeOfProducts.Add(type); _context.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool CompleteProduct(TypeOfProduct typeOfProduct) { var orders = VisitorOrders.OrderBy(x => x.RestOfTime); foreach (var order in orders) { if (order.CompleteProduct(typeOfProduct)) { Score++; return(true); } } return(false); }
//[HttpGet] public ViewResult Products(int id) { TypeOfProduct type = HomeServices.GetProducts(id); if (type == null) { return(View("~/Views/Shared/Error.cshtml")); } ViewBag.Products = type.Products; ViewBag.AmountOfProducts = type.Products.Count(); ViewBag.TypeName = type.Name; return(View("~/Views/Home/Products.cshtml")); }
public static TypeOfProduct GetProducts(int id) { TypeOfProduct type = db.TypeOfProducts.Find(id); if (type == null) { return(type); } type.Products = db.PrimaryProducts .AsNoTracking() .Where(m => m.TypeOfProductId == type.Id) .ToList(); return(type); }
public void ChangeType(TypeOfProduct type) { switch (type) { case TypeOfProduct.Empty: Empty.SetActive(true); Full.SetActive(false); break; case TypeOfProduct.Cola: Empty.SetActive(false); Full.SetActive(true); break; } TypeOfProduct = type; gameObject.SetActive(true); }
public bool CompleteProduct(TypeOfProduct typeOfProduct) { var product = Products.FirstOrDefault(x => x.TypeOfProduct == typeOfProduct); if (product != null) { product.GameObject.SetActive(false); Products.Remove(product); if (Products.Count == 0) { EndOrder(); } else { m_StartTime += Math.Min(AdditionalTime, Time.unscaledTime - m_StartTime); } } return(product != null); }
static void Main(string[] args) { var dictionary = new Dictionary <string, List <TypeOfProduct> >(); dictionary["Alexander"] = new List <TypeOfProduct> { TypeOfProduct.Appliances, TypeOfProduct.Grocery }; dictionary["Oleg"] = new List <TypeOfProduct> { TypeOfProduct.Grocery }; dictionary["Roman"] = new List <TypeOfProduct> { TypeOfProduct.Appliances, TypeOfProduct.BakeryProducts }; // выводим категории товаров пользователей foreach (var item in dictionary) { Console.WriteLine($"Пользователь: {item.Key} приобрел товыры следующих категорий:"); foreach (var cat in item.Value) { Console.WriteLine(cat); } Console.WriteLine(); } // выбираем категорию товаров TypeOfProduct type = TypeOfProduct.Grocery; // выводим пользователей заданной категории товаров Console.WriteLine($"Были найдены следующие пользователи, обравшие товары категории {type.ToString().ToUpper()}: "); foreach (var user in dictionary) { foreach (var cat in user.Value) { if (cat.Equals(type)) { Console.WriteLine(user.Key); } } } Console.ReadKey(); }
public void ChangeType(TypeOfProduct type) { switch (type) { case TypeOfProduct.Bread: BreadBottom.SetActive(true); Sosige.SetActive(false); BreadTop.SetActive(true); break; case TypeOfProduct.HotDog: BreadBottom.SetActive(true); Sosige.SetActive(true); BreadTop.SetActive(true); break; } TypeOfProduct = type; gameObject.SetActive(true); }
void Start() { CountForWin = 0; var types = new TypeOfProduct[] { TypeOfProduct.Cola, TypeOfProduct.Burger, TypeOfProduct.HotDog }; for (var i = 0; i < OrderCount; i++) { var products = new List <TypeOfProduct>(); Orders.Enqueue(products); var productsCount = UnityEngine.Random.Range(1, 4); for (var j = 0; j < productsCount; j++) { products.Add(types[UnityEngine.Random.Range(0, types.Length)]); CountForWin += 1; } } CountForWin -= 2; OnReady?.Invoke(); }
protected override void Seed(coffeestore_online.Models.CoffeeStoreDBContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. IList <TypeOfProduct> typeOfProducts = new List <TypeOfProduct>(); TypeOfProduct type1 = new TypeOfProduct(); type1.TypeOfProductId = "1"; type1.TypeOfProductName = "Tra dao"; TypeOfProduct type2 = new TypeOfProduct(); type2.TypeOfProductId = "2"; type2.TypeOfProductName = "Tra bi dao"; typeOfProducts.Add(type1); typeOfProducts.Add(type2); IList <Product> products = new List <Product>(); Product pd1 = new Product(); pd1.ProductId = "Pr1"; pd1.ProductName = "Ice Coffee"; pd1.ProductPrice = 52000; pd1.ProductDescription = "abc"; pd1.ProductFileNameImg = "abc"; pd1.ProductStatus = true; pd1.TypeOfProductId = "1"; products.Add(pd1); context.TypeOfProducts.AddRange(typeOfProducts); context.Products.AddRange(products); base.Seed(context); }
protected ProcessOrder(ProcessOrder nextRule, TypeOfProduct typeOfProduct) { TypeofProduct = typeOfProduct; NextRule = nextRule; }
internal NewMembershipRule(ProcessOrder processOrder, TypeOfProduct typeOfProduct) : base(processOrder, typeOfProduct) { }
internal PhysicalProductRule(ProcessOrder processOrder, TypeOfProduct typeOfProduct) : base(processOrder, typeOfProduct) { }
internal LearningToSkiVideoRule(ProcessOrder processOrder, TypeOfProduct typeOfProduct) : base(processOrder, typeOfProduct) { }
internal BookRule(ProcessOrder processOrder, TypeOfProduct typeOfProduct) : base(processOrder, typeOfProduct) { }
void CompleteCooking() { TypeOfProduct = TypeOfProduct.Cola; Empty.SetActive(false); Full.SetActive(true); }