Example #1
0
        public async Task <IActionResult> AddCarType([FromBody] CarTypeDTO carType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid model"));
            }

            var result = await carTypeService.AddCarTypeAsync(carType);

            return(Json(result));
        }
Example #2
0
        public async Task <RequestResultDTO> UpdateCarTypeAsync(CarTypeDTO carTypeDTO)
        {
            try
            {
                var carType = mapper.Map <CarType>(carTypeDTO);
                await unitOfWork.CarTypeRepository.UpdateAsync(carType);

                return(new RequestResultDTO());
            }
            catch (Exception ex)
            {
                return(ex.RequestResult());
            }
        }
Example #3
0
        public async Task <IActionResult> UpdateCarType([FromBody] CarTypeDTO carType)
        {
            var result = await carTypeService.UpdateCarTypeAsync(carType);

            return(Json(result));
        }