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