コード例 #1
0
        public IActionResult Create([FromBody] Car car)
        {
            if (car == null)
            {
                return(BadRequest());
            }
            _context.Cars.Add(car);
            _context.SaveChanges();

            return(CreatedAtRoute("GetCar", new { id = car.id }, car));
        }
コード例 #2
0
        public IActionResult Create([FromBody] Image image)
        {
            if (image == null)
            {
                return(BadRequest());
            }
            _context.Images.Add(image);

            _context.SaveChanges();

            return(CreatedAtRoute("GetImage", new { id = image.id }, image));
        }
コード例 #3
0
        public IActionResult Create([FromBody] User user)
        {
            if (user == null)
            {
                return(BadRequest());
            }
            _context.Users.Add(user);
            _context.SaveChanges();

            return(CreatedAtRoute("GetUser", new { id = user.id }, user));
        }