public async Task <IActionResult> Edit(int id, [Bind("Brand,Name,RyansPrice,StarPrice,StarLink,RyansLink,PicLink,Description,ProId")] ProcessorFinal processorFinal) { if (id != processorFinal.ProId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(processorFinal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProcessorFinalExists(processorFinal.ProId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(processorFinal)); }
public async Task <IActionResult> IndexAsync(double?lowAmount, double?largeAmount) { ProcessorFinal productModel = new ProcessorFinal(); var processors = from s in _context.ProcessorFinal select s; if (lowAmount == null || largeAmount == null) { ViewBag.showMsg = "Please enter a prices!"; } else if (lowAmount != null && largeAmount != null) { ViewBag.showMsg = ""; processors = processors.Where(s => s.RyansPrice >= lowAmount && s.RyansPrice <= largeAmount); } //return View(await _context.DataProcessor.ToListAsync()); return(View(await processors.ToListAsync())); //var products = _context.ProcessorFinal.Include(c => c.).Include(c => c.SpecialTag) // .Where(c => c.Price >= lowAmount && c.Price <= largeAmount).ToList(); //if(lowAmount==null ||largeAmount==null) //{ // products = _db.Products.Include(c => c.ProductTypes).Include(c => c.SpecialTag).ToList(); //} //return View(products); }
public async Task <IActionResult> Create([Bind("Brand,Name,RyansPrice,StarPrice,StarLink,RyansLink,PicLink,Description,ProId")] ProcessorFinal processorFinal) { if (ModelState.IsValid) { _context.Add(processorFinal); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(processorFinal)); }
public async Task <IActionResult> Index_Search(String searchkey) { ProcessorFinal productModel = new ProcessorFinal(); var processors = from s in _context.ProcessorFinal select s; if (String.IsNullOrEmpty(searchkey)) { ViewBag.showMsg = "Please enter a keyword!"; } else if (!String.IsNullOrEmpty(searchkey)) { ViewBag.showMsg = ""; processors = processors.Where(s => s.Name.Contains(searchkey)); } //return View(await _context.DataProcessor.ToListAsync()); return(View(await processors.ToListAsync())); }