public async Task <CommonResponse> GetProductDetail(long Id) { try { Expression <Func <Product, bool> > property = p => p.Id == Id; var existing = await _context.Products.FirstOrDefaultAsync(property); if (existing == null) { return(CommonResponse.CreateFailedResponse("No Record Found", 404)); } var model = _mapper.Map <Product, ProductViewModel>(existing); return(CommonResponse.CreateSuccessResponse("Success", model, 200)); } catch (Exception ex) { _logger.LogError(ex, $"CodingTest.QueryStack - Error occured at GetProductDetail"); return(CommonResponse.CreateFailedResponse(ex.Message, 500, "ProductViewModel")); } }