public async Task <ActionResult> InsertSearch(string productName) { PServices services = new PServices(); List <Product> products; if (productName == null) { products = new List <Product>(); } else { products = await services.InsertSearch(productName); } return(View(products)); }
public async Task <IActionResult> Create([Bind("Name_Product,Image_front_url,NovaGroup")] Product product) { PServices service = new PServices(_context); product.despensa = service.DespensaUser(User.Identity.Name); if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
static void LP() { LucroPresumido s1; Console.WriteLine("Digite o valor do seu faturamento: "); double fat = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.WriteLine("Digite o valor do trimestre: "); Console.Write($"Valor do primeiro mês: "); double f1 = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write($"Valor do segundo mês: "); double f2 = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write($"Valor do terceiro mês: "); double f3 = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.WriteLine("Qual o tipo de atividade da sua empresa? (C/S)"); char ativ = char.Parse(Console.ReadLine()); ativ = char.ToUpper(ativ); if (ativ == 'S') { s1 = new PServices(); s1.Revenue = fat; s1.QuarterRevenue.Add(f1); s1.QuarterRevenue.Add(f2); s1.QuarterRevenue.Add(f3); } else { s1 = new PBusiness(); s1.Revenue = fat; s1.QuarterRevenue.Add(f1); s1.QuarterRevenue.Add(f2); s1.QuarterRevenue.Add(f3); } Console.WriteLine(s1); }