private MotorType MapMotorTypeModel(MotorTypeModel motorTypeModel) { return(new MotorType { BrandId = motorTypeModel.BrandId, Id = motorTypeModel.Id, Name = motorTypeModel.Name }); }
public IActionResult UpdateMotorType([FromBody] MotorTypeModel motorTypeModel, int id) { var isUpdated = _motorTypeRepository.Update(id, MapMotorTypeModel(motorTypeModel)); if (!isUpdated) { return(BadRequest()); } return(Ok()); }
public IActionResult PostMotorType([FromBody] MotorTypeModel motorTypeModel) { _motorTypeRepository.Add(MapMotorTypeModel(motorTypeModel)); return(Ok()); }