public string GetCarInfoByEmpId(int empId) { GetCarInfoByEmpIdResponse res = new GetCarInfoByEmpIdResponse(); res.ResultMsg = "success"; res.StateCode = 200; res.Car = _repository.GetByEmpId(empId) ?? new Car(); if (res.Car == null || res.Car.id <= 0) { res.ResultMsg = "no data"; res.StateCode = 200; } return(JsonConvert.SerializeObject(res)); }