public async Task <int> Create(MotorCreateDto dto, string userId) { var createdMotor = _mapper.Map <MotorDbEntity>(dto); createdMotor.CreatedBy = userId; await _dbContext.Motors.AddAsync(createdMotor); await _dbContext.SaveChangesAsync(); return(createdMotor.Id); }
public async Task <IActionResult> Create([FromBody] MotorCreateDto dto) => await GetResponse(async (userId) => new ApiResponseViewModel(true, "Motor Created Successfully", await _service.Create(dto, userId)));