private static string MODULE = "WebAPI.SawController.{0}"; // Pass method name. public Response <DepartmentDto> Get(long departmentId) { Response <DepartmentDto> response = new Response <DepartmentDto>(); try { AssetContext assetContext = new AssetContext(); var department = assetContext.GetDepartmentById(departmentId); if (department != null) { response.Item = department; response.Code = OperationCode.ResponseCode.SUCCESS; response.MessageList.Add(MessageResource.GetInstance().GetText("SawDAL_GetSuccess", MESSAGE_RESOURCE)); } else { response.Code = OperationCode.ResponseCode.NO_FOUND; response.NotFoundList.Add(MessageResource.GetInstance().GetText("SawDAL_GetNotExisting", MESSAGE_RESOURCE)); } } catch (Exception ex) { response.Item = null; response.Code = OperationCode.ResponseCode.ERROR; response.ErrorList.Add(MessageResource.GetInstance().GetText("SawIL_GetInvalid", MESSAGE_RESOURCE)); } return(response); }