Esempio n. 1
0
 public ActionResult Post([FromBody] Computer value)
 {
     if (value is null)
     {
         return(BadRequest(new { error = "not able to create computer object." }));
     }
     ComputerService.AddComputer(value);
     return(Ok());
 }
Esempio n. 2
0
        public void AddComputerView()
        {
            Console.WriteLine("Enter brand: ");
            string brand = Console.ReadLine();

            Console.WriteLine("Enter price");
            string price = Console.ReadLine();

            ComputerService.AddComputer(new Computer {
                Brand = brand, Price = Int32.Parse(price)
            });
        }