public async Task <DeleteDetailsByIdResponse> Handle(DeleteDetailsByIdRequest request, CancellationToken cancellationToken) { //if (request.AuthenticationRole == "UserLaundry") //{ // return new DeleteDetailsByIdResponse() // { // Error = new ErrorModel(ErrorType.Unauthorized) // }; //} var query = new GetWarehauseDetailQuery() { Id = request.Id }; var details = await this.queryExecutor.Execute(query); if (details == null) { return(new DeleteDetailsByIdResponse() { Error = new ErrorModel(ErrorType.NotFound) }); } var mappedDetails = this.mapper.Map <DataAccess.Entities.WarehauseDetail>(request); var command = new DeleteWarehauseDetailCommand() { Parameter = mappedDetails }; var detailsFromDB = await this.commandExecutor.Execute(command); return(new DeleteDetailsByIdResponse() { //Data = this.mapper.Map<Domain.Models.WarehauseDetail>(detailsFromDB) Data = detailsFromDB }); }
public async Task <GetDetailsByIdResponse> Handle(GetDetailsByIdRequest request, CancellationToken cancellationToken) { var query = new GetWarehauseDetailQuery() { Id = request.Id }; var detail = await this.queryexecutor.Execute(query); if (detail == null) { return(new GetDetailsByIdResponse() { Error = new ErrorModel(ErrorType.NotFound) }); } var mappedDetail = this.mapper.Map <WarehauseDetail>(detail); return(new GetDetailsByIdResponse() { Data = mappedDetail }); }