public async Task <IActionResult> AddCarType([FromBody] CarTypeDTO carType) { if (!ModelState.IsValid) { return(BadRequest("Invalid model")); } var result = await carTypeService.AddCarTypeAsync(carType); return(Json(result)); }
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()); } }
public async Task <IActionResult> UpdateCarType([FromBody] CarTypeDTO carType) { var result = await carTypeService.UpdateCarTypeAsync(carType); return(Json(result)); }