public async Task <int> Create(SparePartCreateDto dto, string userId) { var createdSparePart = _mapper.Map <SparePartDbEntity>(dto); await _dbContext.SpareParts.AddAsync(createdSparePart); await _dbContext.SaveChangesAsync(); return(createdSparePart.Id); }
public async Task <IActionResult> Create([FromBody] SparePartCreateDto dto) => await GetResponse(async (userId) => new ApiResponseViewModel(true, "SparePart Created Successfully", await _service.Create(dto, userId)));