Example #1
0
        public async Task <IActionResult> Create([FromBody] CreateGarageModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var garage    = Mapper.Map <Garage>(model);
            var newGarage = await _garageService.CreateAsync(garage);

            if (newGarage == null)
            {
                return(BadRequest());
            }

            return(Ok(newGarage));
        }