コード例 #1
0
 private MotorType MapMotorTypeModel(MotorTypeModel motorTypeModel)
 {
     return(new MotorType
     {
         BrandId = motorTypeModel.BrandId,
         Id = motorTypeModel.Id,
         Name = motorTypeModel.Name
     });
 }
コード例 #2
0
        public IActionResult UpdateMotorType([FromBody] MotorTypeModel motorTypeModel, int id)
        {
            var isUpdated = _motorTypeRepository.Update(id, MapMotorTypeModel(motorTypeModel));

            if (!isUpdated)
            {
                return(BadRequest());
            }

            return(Ok());
        }
コード例 #3
0
 public IActionResult PostMotorType([FromBody] MotorTypeModel motorTypeModel)
 {
     _motorTypeRepository.Add(MapMotorTypeModel(motorTypeModel));
     return(Ok());
 }