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()); }
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) }); }