public async Task <ApiResponse> Handle(EditExitInterviewCommand request, CancellationToken cancellationToken) { ApiResponse response = new ApiResponse(); try { ExistInterviewDetails obj = await _dbContext.ExistInterviewDetails.FirstOrDefaultAsync(x => x.ExistInterviewDetailsId == request.ExistInterviewDetailsId); obj.ModifiedById = request.ModifiedById; obj.ModifiedDate = request.ModifiedDate; _mapper.Map(request, obj); await _dbContext.SaveChangesAsync(); response.StatusCode = StaticResource.successStatusCode; response.Message = "Success"; } catch (Exception ex) { response.StatusCode = StaticResource.failStatusCode; response.Message = ex.Message; } return(response); }
public async Task <ApiResponse> Handle(AddExitInterviewCommand request, CancellationToken cancellationToken) { ApiResponse response = new ApiResponse(); try { ExistInterviewDetails obj = _mapper.Map <ExistInterviewDetails>(request); obj.CreatedById = request.CreatedById; obj.CreatedDate = request.CreatedDate; obj.IsDeleted = false; await _dbContext.ExistInterviewDetails.AddAsync(obj); await _dbContext.SaveChangesAsync(); response.StatusCode = StaticResource.successStatusCode; response.Message = "Success"; } catch (Exception ex) { response.StatusCode = StaticResource.failStatusCode; response.Message = ex.Message; } return(response); }