Esempio n. 1
0
        public async Task Create(CarJson car)
        {
            Car c = new Car
            {
                Brand = car.Brand,
                Type  = car.Type,
                Price = car.Price
            };

            context.Cars.Add(c);
            await context.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task <ActionResult> Create([FromBody] CarJson car)
        {
            try
            {
                await carRepository.Create(car);

                return(Ok());
            }
            catch
            {
                return(BadRequest());
            }
        }
 public static Car ToCar(this CarJson json)
 {
     return(new Car {